Flushes the buffer to disk.
int fflush (FILE * stream);
Required Header |
<stdio.h> |
Return Value
This function returns zero if the file was successfully flushed. A non-zero value indicates an error.
Parameters
stream
A pointer to the open FILE structure
Remarks
The fflush function does nothing when stream is in write mode except check that stream is a valid open file. Because the file system works in complete records, it would make no sense to flush an incomplete record in the JCC library.
If stream is in read mode, the last character pushed back on the stream is discarded if (and only if) it was not possible to push that character back into the actual read buffer. This only happens when the buffer has progressed to a new track and an attempt to pushback the last character of the previous buffers content was made. This always allows at least two characters to be pushed back with the JCC library, since to progress to a new buffer content, at least one character must have been requested from that buffer.
read/write files will write out the currently updated data in the read for update handle. To ensure all data is written from the buffers to disk, write zeros to fill the last block to force a commit of the primary buffers. fclose also performs this function in read/write files.