Does NEWLINE always flush stdio buffer?

Knudsen knudsen at ihlpl.ATT.COM
Fri Jun 30 05:05:15 AEST 1989


I'd always understood that printf'ing any string ending in '\n'
(newline) would flush the I/O buffer.
However, I've found that this will not always flush if stdout has been
redirected to a pipe.

Possibly the failure is related to whether or not the byte preceding
the newline is a printable ASCII character or not.
I know about fflush(), which always works, but it can be a pain
to call it in some cases.

Does anyone know the "official" rules of the traditional stdio
library?  (Not the ANSII standard; I'm dealing with an older
system).  Thanks, mike k
-- 
Mike Knudsen  Bell Labs(AT&T)   att!ihlpl!knudsen  knudsen at ihlpl.att.com
  Round and round the while() loop goes;
  "Whether it stops," Turing says, "no one knows!"
Shotguns -- just say PULL!



More information about the Comp.lang.c mailing list