Flushing output on a buffered stream means transmitting all accumulated characters to the file. There are many circumstances when buffered output on a stream is flushed automatically:
exit. See section Normal Termination.
If you want to flush the buffered output at another time, call
fflush, which is declared in the header file `stdio.h'.
fflushcauses buffered output on all open output streams to be flushed.
This function returns
EOF if a write error occurs, or zero
Compatibility Note: Some brain-damaged operating systems have been known to be so thoroughly fixated on line-oriented input and output that flushing a line buffered stream causes a newline to be written! Fortunately, this "feature" seems to be becoming less common. You do not need to worry about this in the GNU system.
Go to the first, previous, next, last section, table of contents.