将std :: cerr写入txt文件 [英] Write std::cerr to txt file
本文介绍了将std :: cerr写入txt文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经为现有项目添加了一些方法.它已正确写入txt文件.但是我现在只能看到我最近添加的std :: cerr文本,我像
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
可能的原因是什么?
推荐答案
如果您希望重定向错误流,则应使用类似以下内容的内容:
./faceDemo > std.log 2> err.log
如果您希望将两个流重定向到同一文件中,请使用以下命令:
./faceDemo > run.txt 2>&1
2>&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
这篇关于将std :: cerr写入txt文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文