Writes out any buffered information for the specified file. Format #include <stdio.h> int fflush (FILE *file_ptr);
1 – Argument
file_ptr A file pointer. If this argument is a NULL pointer, all buffers associated with all currently open files are flushed.
2 – Description
The output files are normally buffered only if they are not directed to a terminal, except for stderr, which is not buffered by default. The fflush function flushes the Compaq C RTL buffers. However, RMS has its own buffers. The fflush function does not guarantee that the file will be written to disk. (See the description of fsync for a way to flush buffers to disk.) If the file pointed to by file_ptr was opened in record mode and if there is unwritten data in the buffer, then fflush always generates a record.
3 – Return Values
0 Indicates that the operation is successful. EOF Indicates that the buffered data cannot be written to the file, or that the file control block is not associated with an output file.