• 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
Re: Writing NSString to a file descriptor
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing NSString to a file descriptor


  • Subject: Re: Writing NSString to a file descriptor
  • From: AstroK Software <email@hidden>
  • Date: Tue, 20 Nov 2007 22:12:50 +0100

Hi Gorazd,

thanks for your answer. I tried allocating the pipe with [[NSPipe alloc] init], but I still get a "Bad file descriptor". I really don't get what is wrong. I also tried to retain the file handle fh, just in case, but it doesn't work either...

 -- Arthur;


Le 20 nov. 07 à 21:52, Gorazd Krosl a écrit :

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


_______________________________________________

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


References: 
 >Re: Writing NSString to a file descriptor (From: Gorazd Krosl <email@hidden>)

  • Prev by Date: Re: Position of NSStatusItem
  • Next by Date: sizeToFit without actually changing the size?
  • Previous by thread: Re: Writing NSString to a file descriptor
  • Next by thread: float[4][3] into NSValue
  • Index(es):
    • Date
    • Thread