问题
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