Re: Writing NSString to a file descriptor
Re: Writing NSString to a file descriptor
- Subject: Re: Writing NSString to a file descriptor
- From: Gorazd Krosl <email@hidden>
- Date: Tue, 20 Nov 2007 15:52:35 -0500 (EST)
Hi Arthur,
>NSPipe *pipe = [NSPipe pipe]; // Allocation of
autoreleased "pipe"
>NSFileHandle *fh = [pipe fileHandleForWriting]; //
since "pipe" is autoreleased "fh" is too.
>[fh readInBackgroundAndNotify]; // you are reading in
background, so your app will go through event loop.
When your callback is called, your pipe is probably
released and so your file handle is gone too, which
results in bad file descriptor. Get pipe with [[NSPipe
alloc] init] and release it when done with it.
Regards,
Gorazd
Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden