Stdio buffering question

John F. Haugh II jfh at rpp386.UUCP
Sat Jun 11 13:06:10 AEST 1988


the reason printf buffers when writing to a non-terminal is because it
is cheaper (cpu-wise) to wait until an entire buffer is full.  if you
really want to see the output immediately regardless of the output
destination, you must use fflush.  this is a very common situation
when using fprintf or printf for debugging a program which core dumps.

- john.



More information about the Comp.unix.wizards mailing list