FROM : AstroK Software
DATE : Tue Nov 20 22:12:50 2007
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
DATE : Tue Nov 20 22:12:50 2007
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
| Related mails | Author | Date |
|---|---|---|
| AstroK Software | Nov 20, 19:47 | |
| Gorazd Krosl | Nov 20, 21:52 | |
| AstroK Software | Nov 20, 22:12 | |
| Alastair Houghton | Nov 21, 11:47 |






Cocoa mail archive

