FlushFileBuffers

  BOOL FlushFileBuffers(hFile)    
  HANDLE hFile; /* handle to file to which function will write data */

The FlushFileBuffers function clears the buffers for the specified file and causes all buffered data to be written to the file.

Parameters

hFile

Specifies an open file handle. The file handle must have been created with GENERIC_WRITE access to the file.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

The WriteFile and WriteFileEx functions typically write data to an internal buffer that is written to disk on a regular basis. The FlushFileBuffers function writes all of the buffered information for the specified file to disk.

If hFile specifies a communications device, this function flushes only the transmit buffer.

If hFile specifies the server end of a named pipe, this function will not return until the client has read all buffered data from the pipe.

See Also

WriteFile, WriteFileEx