I know how to send data to the task:
NSData *charlieSendData = [[charlieImputText stringValue] dataUsingEncoding:NSUTF8StringEncoding];
[[[task standardInput] fileHandleForWriting] writeData:charlieSendData];
But how do I get what the task responds with??
Elijah
Give an
NSPipeor anNSFileHandleas the task’sstandardOutput, and read from that.Note that if you use a pipe, you have to worry about the pipe filling up. If you provide an
NSFileHandleinstead, the task can output all it wants without you having to worry about losing any, but you also get the overhead of having to write the data out to disk.