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 12:39:26 -0800
> Do you possibly call the code you have written to install this
> handler from an
> assert macro?
> Such code gets stripped in release builds.
Good to know, but this is not what's happening here. I'm calling it
from within a Cocoa method:
- (void)startRedirect
{
if (!oldWriteFunc)
{
oldWriteFunc = stream->_write;
stream->_write = stream == stdout ? stdoutwrite : stderrwrite;
}
}
Full code can be found here:
https://svn.mat.ucsb.edu/projects/luaAV/browser/branches/mergathon/LuaAV/library/osx/LuaAVLog.m
What's interesting is that in other bits of code within my project,
I've tried printing out the address of stdout->_write and it's exactly
the address of my stdoutwrite handler function. For whatever reason,
std::cout, printf and fputs are not respecting stdout->_write when the
app is launched from Finder. This begs 2 questions
1) Why is this so?
2) What is the proper way to redirect stdout from within a Cocoa app?
So far I've found no example code online. Any pointers would be great.
thanks,
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