Re: stdout redirect in xcode and not
Re: stdout redirect in xcode and not
- Subject: Re: stdout redirect in xcode and not
- From: "Wesley Smith" <email@hidden>
- Date: Mon, 22 Dec 2008 13:12:22 -0800
On Mon, Dec 22, 2008 at 1:06 PM, Jason Foreman <email@hidden> wrote:
> On Dec 22, 2008, at 2:39 PM, Wesley Smith wrote:
>
>> - (void)startRedirect
>> {
>> if (!oldWriteFunc)
>> {
>> oldWriteFunc = stream->_write;
>> stream->_write = stream == stdout ? stdoutwrite :
>> stderrwrite;
>> }
>> }
>>
>
> I took a quick glance, and "stream" appears to be a FILE* in your code. You
> shouldn't really modify a FILE structure this way--treat a FILE* as though
> it were just an opaque pointer to something you know nothing about. Messing
> with its insides is only going to lead you to trouble.
>
> If you want to redirect all stdout output to stderr, you can use something
> like dup2(...) [`man 2 dup2`] to switch the fd of stdout to point to stderr.
Thanks. I'll check it out. Just to clarify, I'm not trying to
redirect stdout to stderr. I intend to redirect both to custom
handlers such that I can display them in the app's console.
wes
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden