osx - Objective c: How to know the progress of formatting USB drive in using NSTask -


i use nstask execute format usb drive ntfs fat32. works well, know progress when starts format.

here 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 add progress keep track of formatting.(like percentage done...) !!

the task wrap nstask needs first providing progress updates. there, can watch stderr , stdout. if there updates them, can interpret , post notification main thread. use notification make gui updates.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -