title: How to write a file then read it back to verify its contents, ensuring you're getting what's on the disk not the cache
body: <p>I'm using native/C++/Win32/MFC code on Windows to save a document file via MFC serialization.  I've inserted my own CFile-derived class in the writing process giving me access to the data as its being written.  This allows me to compute a checksum (or hash, etc) on the data as its going out to the file.</p>
  
  <p>After the files has saved, I'd like to allow the option of verifying the file.  The idea would be to re-open the file and read through it verifying the checksum/hash/etc.</p>
  
  <p>I'm wondering, though, if its possible that after having just written the file, the OS could be giving me unwritten data when I read the file back right away.  In this case, the test doesn't really tell me that the file looks good on the disk.</p>
  
  <p>Is my concern valid?  If so, is there any way to avoid this issue?</p>