FlushFileBuffers

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

At a Glance

Header file: Winbase.h
Windows CE versions: 1.0 and later

Syntax

BOOL WINAPI FlushFileBuffers (HANDLE hFile);

Parameters

hFile

[in] Handle to an open file. The function flushes this file’s buffers. The file handle must have GENERIC_WRITE access to the file.

If hFile is a handle to a communications device, the function only flushes the transmit buffer.

If hFile is a handle to the server end of a named pipe, the function does not return until the client has read all buffered data from the pipe.

Return Values

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

The WriteFile function typically writes data to an internal buffer that the operating system writes to disk on a regular basis. The FlushFileBuffers function writes all of the buffered information for the specified file to disk.