I use NSTask to execute format USB drive from NTFS to FAT32. It works well, but I would like to know the progress when it starts to format.
Here is my code:
NSTask *task = [NSTask new];
[task setLaunchPath:@"/usr/bin/env"];
[task setArguments:[NSArray arrayWithObjects:@"diskutil", @"eraseVolume", @"MS-DOS" ,name ,path,nil]];
NSPipe *pipe = [NSPipe pipe];
[task setStandardOutput:pipe];
[task launch];
[task waitUntilExit];
How to add progress to keep track of the formatting.(like the percentage done...) Thanks !!