Write std::cerr to txt file

喜欢而已 提交于 2019-12-10 11:45:46

问题


I've added some methods to an existing project. It was writing correctly to a txt file. However i can only see my recently added std::cerr texts now, i execute my project like

./faceDemo > run.txt

What are the possible reasons?


回答1:


If you wish to redirect the error flow, you should use something like that :
./faceDemo > std.log 2> err.log

And if you wish to redirect both flows in the same file use this :
./faceDemo > run.txt 2>&1

2>&1 means redirect error flow into std flow



来源:https://stackoverflow.com/questions/23659229/write-stdcerr-to-txt-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!