FlushViewOfFile
FlushViewOfFile initiates writeback of dirty pages in a selected range of a Windows file mapping.
The call covers dirty mapped pages, not file metadata, and does not wait for the hardware disk cache to reach persistent media. The documented sequence for both boundaries is FlushViewOfFile followed by FlushFileBuffers. Both calls return nonzero on success and zero on failure; inspect GetLastError on failure. [1] [2]
A zero length flushes from the supplied address to the end of the mapping. Network completion does not establish remote persistence. Mapped writes may also leave the last-modification timestamp unchanged; SetFileTime is a separate operation when an update is required. [1]
Relations
- related
- FlushFileBuffers, FILE_FLAG_WRITE_THROUGH, Memory-mapped file, msync, SMB FLUSH, FILE_FLAG_NO_BUFFERING
Citations
- Microsoft: FlushViewOfFile, mapped pages and persistence boundaries
- Microsoft: FlushFileBuffers, parameters, return value and remarks
Further reading
Sources & caveats
- Microsoft Win32 documentation reviewed 14 November 2026; no Windows runtime, power-loss or remote-server experiment was performed.
- Related POSIX and Linux APIs are comparisons, not claims of equivalent completion or error semantics.