FILE_FLAG_WRITE_THROUGH
FILE_FLAG_WRITE_THROUGH is a Windows file-open flag that requests immediate propagation of writes instead of delayed cache writeback.
Write-through alone can still use the Windows system cache. FILE_FLAG_NO_BUFFERING independently bypasses that cache for file-data I/O; it does not affect disk hardware caching or memory-mapped files. Combining both flags bypasses the system cache and requests hardware-cache write-through, subject to device support. [1]
On NTFS, write-through also flushes metadata changes resulting from that request. NO_BUFFERING alone can leave metadata cached; use FlushFileBuffers when that metadata must be flushed. Unbuffered file I/O also requires appropriate transfer-size, offset and buffer-address alignment. Neither flag supplies multi-operation atomicity. [1] [2] [3]
Relations
- related
- FlushFileBuffers, FlushViewOfFile, Write-through cache, Direct I/O, Storage cache flush, FILE_FLAG_NO_BUFFERING
Citations
- Microsoft: CreateFileA, Caching Behavior and independent file flags
- Microsoft: File Caching, write-through and metadata
- Microsoft: File Buffering, alignment and hardware-cache scope
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.