I tried researching the difference between cout
, cerr
and clog
on the internet but couldn\'t find a perfect answer. I still am not cle
stdout
and stderr
are different streams, even though they both refer to console output by default. Redirecting (piping) one of them (e.g. program.exe >out.txt
) would not affect the other.
Generally, stdout
should be used for actual program output, while all information and error messages should be printed to stderr
, so that if the user redirects output to a file, information messages are still printed on the screen and not to the output file.