Mail Archives: djgpp/1999/05/16/07:07:14
On Sat, 15 May 1999, Ike wrote:
> What exactly does fflush(stdout) do
It flushes any buffered output that wasn't written to the screen (or
file, if stdout was redirected).
> and why would it be used on stdout?
When stdout is connected to the screen, it is line-buffered. This means
that the characters are buffered until a newline is seen, and then the
entire line is written to the screen. If you want the text to appear on
the screen before the newline, you need to call fflush.
> How is different for file streams?
It isn't. File streams call the same buffered I/O functions under the
hood.
- Raw text -