When to use fflush()?

Doug Gwyn gwyn at smoke.BRL.MIL
Sun Sep 3 09:04:06 AEST 1989


In article <14507 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer) writes:
>I've forgotten whether this issue was ever resolved: what should happen if the
>output stream is a VMS record-oriented file?  If the currently buffered output
>contains no newlines, is it appropriate for fflush() to do nothing, and return
>success?

The specification says that unwritten data IS delivered to the host
environment.  It does not (and cannot) be specific about how that is
actually accomplished.  Section 4.9.3 of the pANS describes buffering
matters using the phrase "intended to", in acknowledgement of the
fact that host environments vary widely in this regard.

I would think that so long as the implementation ensures that the
data will reach the record-structured file SOMEtime, that would
suffice.  Certainly on a terminal, though, the flush should cause
the unwritten characters to immediately be sent to the terminal.



More information about the Comp.lang.c mailing list