iPhone SDK: Redirecting stderr/stdout to XCode console
I have a C library that I'm planning to use in an iPhone application. It writes a lot of its debug information to stderr. Is there an easy way to redirect stderr/stdout to my XCode console?
Will I have to write wrappers t开发者_Python百科hat call NSLog? If so, what would be the best way of doing so?
I know that stdout at least already goes to the console. I am not 100% sure about stderr.
You can simply do a print
, and it will end up in XCode's console.
Edit: Found some references confirming stderr as well.
There’s no need to redirect anything, all the output goes to the console already. Try that:
fprintf(stdout, "Standard output.\n");
fprintf(stderr, "Standard error output.\n");
精彩评论