fflush

Flushes the output buffer of a stream

Local Servers:blocking
Remote Servers:blocking
Classification:ANSI
Platform:NLM
Service:Stream I/O

Syntax

  #include <stdio.h>  
   
  int fflush  (  
     FILE   *fp);
  

Parameters

fp
(IN) Points to the file to be flushed.

Return Values

The fflush function returns nonzero if a write error occurs, and returns zero otherwise. If an error occurs, errno is set.

Remarks

If the file pointed to by fp is open for output or update, the fflush function causes any unwritten data to be written to the file. If the file pointed to by fp is open for input or update, the fflush function undoes the effect of any preceding ungetc operation on the stream. If the value of fp is NULL, all open files are flushed.

See Also

fgetc, fgets, flushall, fopen, getc, gets, setbuf, setvbuf, ungetc