Codeblocks: set files for stdin, stdout?
How can i set files for stdin and stdout in codeblocks ide. I would be better if i can s开发者_开发知识库et them different for each build target. It may be linux only solution.
Well this is not an IDE problem per se and you will need to solve this by coding. But assuming you have two build targets in CodeBlocks named "Debug" and "Release". Go to Project->Build Options->Compiler Settings->#defines For Debug Target give a macro like : FOO_DEBUG and for Release: FOO_RELEASE
Finally somewhere in the initialization of your program differentiate between the different build targets like so:
#ifdef FOO_DEBUG
freopen("in_d.log","r",stdin);
freopen("out_d.log","w",stdout);
#else
freopen("in_r.log","r",stdin);
freopen("out_r.log","w",stdout);
#endif
精彩评论