• 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: stdout redirect in xcode and not
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: stdout redirect in xcode and not
      • From: "Wesley Smith" <email@hidden>
References: 
 >stdout redirect in xcode and not (From: "Wesley Smith" <email@hidden>)
 >Re: stdout redirect in xcode and not (From: Tommy Nordgren <email@hidden>)
 >Re: stdout redirect in xcode and not (From: "Wesley Smith" <email@hidden>)
 >Re: stdout redirect in xcode and not (From: Jason Foreman <email@hidden>)

  • Prev by Date: Re: stdout redirect in xcode and not
  • Next by Date: Code completion on c++ classes
  • Previous by thread: Re: stdout redirect in xcode and not
  • Next by thread: Re: stdout redirect in xcode and not
  • Index(es):
    • Date
    • Thread