Link to home
Start Free TrialLog in
Avatar of paulchen
paulchen

asked on

disable cout buffering

How can I disable the buffering of output from cout?

Thank you!
ASKER CERTIFIED SOLUTION
Avatar of md041797
md041797

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of paulchen
paulchen

ASKER

hello md!

thank you for your answer.
unfortunately, it didn't work. it still gets all buffered and
output after program termination.

I've never seen this before.  What platform/compiler?

BTW, I recall that cout is unitbuf by default.
Does "cerr" behave like you want it to (ie. unbuffered?) If it does not, then the problem could be with the OS, not the libraries you are using. (cerr is tied to fd 2 (stderr) instead of fd 1 (stdout) and is supposed to be unbuffered, though both are based the same parent class (as far as I know, may be implementation dependant)).

"clog" is supposed to be an unbuffered "cerr".
How do they do it? (tracking this doen might help)