Does NEWLINE always flush stdio buffer?

Doug Gwyn gwyn at smoke.BRL.MIL
Sun Jul 2 13:29:16 AEST 1989


In article <11012 at ihlpl.ATT.COM> knudsen at ihlpl.ATT.COM (Knudsen) writes:
>I'd always understood that printf'ing any string ending in '\n'
>(newline) would flush the I/O buffer.
>...
>Does anyone know the "official" rules of the traditional stdio library?

Yes, they're described in TFM.  By default (i.e. unless setbuf() or
setvbuf() is used to change it), terminal output is line-buffered,
stderr is unbuffered, and all other I/O streams are fully (block)
buffered.



More information about the Comp.lang.c mailing list