std::flush, what's it good for?

Why use flush? What does it exactly do, and also is it bad to use a lot of std::endl's through-out one's coding?

 
std::cout<<("See")<<std::endl<<std::flush;
Last edited on
http://www.cplusplus.com/reference/iostream/manipulators/flush/

flush() makes sure the file stream is updated with the data.
endl() puts a newline and then uses flush().

It's not bad to use a lot of either, just unnecessary.

For instance, on Haiku (which is another operating system) you are expected to flush std::cout or the text won't display.
On Windows, in my experience, that's not needed.
Is it necessary to use flush in windows 7 OS? or I can just continue using endl as it is?
endl will call flush so no need to call flush immediately after endl.
oops just re-read what you said, never mind my question
Topic archived. No new replies allowed.