Can anybody explain the difference between cerr cout and clog and why does different objects are proposed?
I know the differences are as below:
1) cout can redirected but cerr can’t
2) clog can use buffer.
I am confused about the point 2, I am grateful if anybody can elaborate it more.
Buffered output is typically much faster than unbuffered. So if you wanted to write a vast amount of data quickly to a log (but didn’t care if it actually ended up there), you would use clog rather than cerr.
And all streams can normally be redirected, assuming a vaguely competent operating system, but this is outwith the C++ standard, which has no such concept as “redirection”.