FlushViewOfFile

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

BOOL FlushViewOfFile( 
LPCVOID lpBaseAddress, 
DWORD dwNumberOfBytesToFlush );

Parameters

  • lpBaseAddress
    Pointer to the base address of the byte range to be flushed to the disk representation of the mapped file.
  • dwNumberOfBytesToFlush
    Specifies the number of bytes to flush. This parameter cannot be set to zero.

Return Values

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

Remarks

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, FlushViewOfFile 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, FlushViewOfFile can return before the data has been physically written to disk. However, you can cause FlushViewOfFile 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 CreateFileForMapping function.

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 1.01 and later Winbase.h   Coredll.lib, Nk.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CreateFile, CreateFileForMapping, MapViewOfFile, UnmapViewOfFile

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.