Am Sonntag, den 19.06.2011, 19:29 +0200 schrieb Uwe Hermann:
Flushing stdout after each message ensures that the
...if you want to flush immediately after each message, you better
off buffering of stdout alltogether using setvbuf in the startup code, I
Hm, maybe, but then again we should check how portably you can disable
buffering (on DOS, win, freebsd, etc).
The fflush() is most likely to work everywhere I think
(but I haven't tested it).
fflush just cares about the buffer in libc, not about
any buffering in
the OS (not that I am aware of that any OS buffers screen outputs,
though). if you just care about the libc buffer, there is no problem
with setvbuf, as this function is ANSI, and as it is just about when
libc passes the data to the OS, perfectly portable. I remember having
seen this function already in Turbo C 2.0 (And that is years before
Turbo C++ 2.0)