different between cout and cerr

can i know what exactly the difference between cerr and cout? when should used cerr and when should used cout?
std::cout writes to a different stream than std::cerr, and std::cerr doesn't have a buffer (which std::cout does). Generally a terminal will display both streams, though.

As a rule of thumb, I use std::cout for processed data and data that I might want to forward to another application for more processing, and std::cerr for errors, notices, and data that shouldn't really be included in the other stream (in my opinion). That's me, though. :)

Last edited on
std::cout - Regular output (console output)
std::cerr - Error output (console error)
std::clog - Nobody cares (console log)
I don't think cout is guaranteed to be buffered, and cerr may be line buffered iirc.
just get confuse about these kind of output console.... thanks for clearing my mind!
Topic archived. No new replies allowed.