Standard output and bad file descriptor ?
Standard output and bad file descriptor ?
- Subject: Standard output and bad file descriptor ?
- From: Thomas Deniau <email@hidden>
- Date: Tue, 11 Dec 2001 20:02:50 +0100
Hi !
I need to put the standard output of a daemon in a text view.
This is easy when you launch the NSTask yourself.
But the daemon might already be launched when my app is launched.
So I need to get the daemon's standard output by some way.
I tried to use DO :
In the daemon, I've put
- (NSFileHandle *) outputFileHandle
{
return [NSFileHandle fileHandleWithStandardOutput];
}
And in the 'controller' app I use the file handle to put the data in the
text field :
NSData * data;
NSFIleHandle * handle = [theProxy outputFileHandle];
while ([data=[handle availableData] length])
{
...
}
But I get the following error :
*** Uncaught exception: <NSFileHandleOperationException> ***
-[NSConcreteFileHandle availableData]: Bad file descriptor
What does this mean ? How to solve it ?
TIA,
--
Thomas Deniau