如下的代码:
#include
#include
#include
#include
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
cout << "The std cout output msg" << endl;
qDebug() << "The qDebug output msg";
qInfo() << "The qInfo output msg";
qWarning() << "The qWarning output msg";
qCritical() << "The qCritical output msg";
qFatal("The qFatal output msg");
return 0;
}
在Linux中程序有2个关键,一个是标准输出,一个是标准错误,在C语言中,有stderr和stdout。
程序运行截图如下:
如果把标准输出重定向到1.txt文件中:那么屏幕就只会输出stderr