[flashrom] [PATCH] Flush stdout after each message

Michael Karcher flashrom at mkarcher.dialup.fu-berlin.de
Sun Jun 19 22:23:06 CEST 2011


Am Sonntag, den 19.06.2011, 19:29 +0200 schrieb Uwe Hermann: 
> > > Flushing stdout after each message ensures that the message appears
> > > immediately.
> > ...if you want to flush immediately after each message, you better turn
> > off buffering of stdout alltogether using setvbuf in the startup code, I
> > think.
> 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)

Regards,
  Michael Karcher





More information about the flashrom mailing list