Reading NSTask output
Reading NSTask output
- Subject: Reading NSTask output
- From: Aidas <email@hidden>
- Date: Thu, 29 Aug 2002 18:54:40 +0200
Hi,
I have problems getting NSTask output. It gives me error and I don't know
what to do! Here is that error:
-[NSConcreteFileHandle readDataOfLength:]: Bad file descriptor
And here is my code:
NSString* error;
NSString* output;
NSData *myData;
NSData *myData2;
cinfo_task=[[NSTask alloc] init];
arrayWithObjects:@"-l",[self getport],@"query",nil]];
[cinfo_task setArguments:[NSArray arrayWithObjects:@"-l",[self
getport],@"query",nil]];
[cinfo_task setLaunchPath:[self photopcpath]];
[cinfo_task setStandardError:[NSFileHandle fileHandleWithStandardError]];
[cinfo_task setStandardOutput:[NSFileHandle fileHandleWithStandardOutput]];
[cinfo_task launch];
myData=[[cinfo_task standardOutput] readDataToEndOfFile];
myData2=[[cinfo_task standardError] readDataToEndOfFile];
[myData getBytes:output];
[myData2 getBytes:error];
I don't know how to use NSFilehandlea at all.
Thank you
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.