开发者

iPhone SDK: Redirecting stderr/stdout to XCode console

开发者 https://www.devze.com 2022-12-25 07:12 出处:网络
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?

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");
0

精彩评论

暂无评论...
验证码 换一张
取 消