What is the difference between them and how are they used? Can anyone point me to examples?
Specifically, how do you \"write\" to the stream in both cases and how do you
What is the difference between them
stderr
is a FILE*
, and part of the standard C library. cerr
is an ostream
, and part of the standard C++ library.
Also, the "screen" output is itself a stream right?
Yes, it is. But there are actually two streams that write to the screen by default: stdout
/cout
is for normal output and stderr
/cerr
is for error messages. This is useful for redirection: You can redirect stdout
to a file but still have your error messages on the screen.