Windows File Buffering

Afternoon, all,

I am in the process of reading up about windows file buffering; disk files, to be specific. Whilst I understand that Windows employs an output buffer (unless explicity requested not to), I am not sure if the same can be said for input buffers.

So, my question is: does Windows store data in an input buffer managed by the OS for use in ReadFile calls? I know C++'s std::fstream does this, but was not sure if Windows does.

Thanks,
Last edited on
When writing uses a buffer reading needs to use it as well. Otherwise when you write to a file and read from it you may get outdated data. See:

https://docs.microsoft.com/en-us/windows/win32/fileio/file-caching

For more about this subject.
Thank you for getting back to me on this, coder777. And a nice article; shame I missed that before. Always around to help, as always. Anyway, thank you again :)
File system metadata is always cached. Therefore, to store any metadata changes to disk, the file must either be flushed or be opened with FILE_FLAG_WRITE_THROUGH.
Topic archived. No new replies allowed.