• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Reading NSTask output
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Cocoa Info
  • Next by Date: Update to Jaguar Dev Tools available
  • Previous by thread: Re: Getting the state of the option key...
  • Next by thread: Update to Jaguar Dev Tools available
  • Index(es):
    • Date
    • Thread