FlushFileBuffers
FlushFileBuffers requests that buffered information for an open Windows file be written to its underlying device.
For an ordinary file, the handle requires GENERIC_WRITE. A nonzero return reports success; zero requires inspecting GetLastError. Named-pipe handles have a different completion contract: a server-side call waits for the client to read the buffered data. [1]
For mapped writes, use FlushViewOfFile followed by FlushFileBuffers to cover dirty mapped pages, file metadata and the documented disk-persistence boundary. Check both results. This sequence is not a multi-write transaction or a substitute for coordinating concurrent writers. [2]
Relations
- related
- FlushViewOfFile, FILE_FLAG_WRITE_THROUGH, fsync, Memory-mapped file, Storage cache flush, FILE_FLAG_NO_BUFFERING
Citations
- Microsoft: FlushFileBuffers, parameters, return value and remarks
- Microsoft: FlushViewOfFile, mapped pages and persistence boundaries
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.