MSDN Library


Windows Mobile 6.5
A version of this page is also available for

This function writes to the disk a byte range in a mapped view of a file.

BOOL FlushViewOfFile( 
  LPCVOID lpBaseAddress, 
  DWORD dwNumberOfBytesToFlush 


[in] Pointer to the base address of the byte range to be flushed to the disk representation of the mapped file.


[in] Number of bytes to flush. This parameter cannot be set to zero.

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

Flushing a range of a mapped view causes any dirty pages within that range to be written to the disk. Dirty pages are those whose contents have changed since the file view was mapped.

When flushing a memory-mapped file over a network, this function guarantees that the data has been written from the local computer, but not that the data resides on the remote computer. The server can cache the data on the remote side. Therefore, this function can return before the data has been physically written to disk. However, you can cause this function to return only when the physical write is complete by specifying the FILE_FLAG_WRITE_THROUGH flag when you open the file with the CreateFile or the CreateFileForMapping function.

Windows Embedded CEWindows CE 1.01 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

© 2015 Microsoft