Pointer to the file stream to flush. If `NULL`, all output streams are flushed.
Read more about parameters of fflush in parameters section
The fflushfunction in C language Flushes the output buffer of a file stream.
The fflush function forces a write of all buffered data for the given output or update stream via the stream's underlying write function. If the stream is an input stream or an update stream in which the most recent operation was input, it has no effect and returns zero. If stream is a null pointer, fflush flushes all open output streams.
The fflushfunction takes 1
parameter:
•
FILE * `stream`: Pointer to the file stream to flush. If `NULL`, all output streams are flushed.
Flushes the output buffer of a file stream, ensuring that any buffered data is written to the file. If the parameter is `NULL`, it flushes all open output streams. Returns `0` on success or `EOF` on error.
The fflush function return value :
Returns 0 if the stream was successfully flushed
Otherwise, it returns EOF and sets errno to indicate the error
Output
This example demonstrates the basic usage of `fflush`. It forces the first printf output to be displayed immediately, even without a newline character.