Next: Flushing Buffers, Up: Stream Buffering [Contents][Index]
There are three different kinds of buffering strategies:
Newly opened streams are normally fully buffered, with one exception: a stream connected to an interactive device such as a terminal is initially line buffered. See Controlling Which Kind of Buffering, for information on how to select a different kind of buffering. Usually the automatic selection gives you the most convenient kind of buffering for the file or device you open.
The use of line buffering for interactive devices implies that output
messages ending in a newline will appear immediately—which is usually
what you want. Output that doesn’t end in a newline might or might not
show up immediately, so if you want them to appear immediately, you
should flush buffered output explicitly with
fflush, as described
in Flushing Buffers.