开发者

Codeblocks: set files for stdin, stdout?

开发者 https://www.devze.com 2023-03-06 16:11 出处:网络
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

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
0

精彩评论

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