Generally you use std::cout
for normal output, std::cerr
for errors, and std::clog
for "logging" (which can mean whatever you want it to mean).
The major difference is that std::cerr
is not buffered like the other two.
In relation to the old C stdout
and stderr
, std::cout
corresponds to stdout
, while std::cerr
and std::clog
both corresponds to stderr
(except that std::clog
is buffered).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…