Re: redirect stderr
Re: redirect stderr
- Subject: Re: redirect stderr
- From: Lindsey Spratt <email@hidden>
- Date: Tue, 5 Nov 2002 18:37:47 -0600
On Tuesday, November 5, 2002, "Jeff Schindler"
<email@hidden> wrote:
>
| Hello,
>
|
>
| Is there any easy (or hard) way to redirect stderr, or more
>
specifically
>
the
>
| output from NSLog? We'd like to output it to a window in our
>
application.
I don't know of an easy way. I set up a general I/O redirection in the
Cocoa wrapper for gprolog that I'm building. To do this I create my own
FILE structure 'windowIO', then set stdout, stderr, and stdin equal to
'&windowIO'.
The windowIO structure has function pointers in it for close, read,
write, seek and something else I'm forgetting. I wrote my own functions
for these. My read and write functions were the really interesting
part. You would only need a write function (which is easier than the
read function because you don't need to handle blocking). The write
function sends a message using the objc_msgSend procedure to an ObjC
object that can get to the NSTextView for your error log window.
Simple. :-)
Lindsey Spratt
http://homepage.mac.com/lspratt
_______________________________________________
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.