先看cout
#include <iostream>
#include <unistd.h>
int main()
{
std::cout << "this is cout";
while(1)
{
sleep(3);
}
return 0;
}
结果:什么都不会输出
再看cerr
将上面代码,换成:std::cerr << "this is cerr";
结果:直接输出
再看clog
将上面代码,换成:std::clog << "this is clog";
结果:直接输出