Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>See this discussion of <a href="http://msdn.microsoft.com/en-us/library/cc644950%28v=VS.85%29.aspx" rel="nofollow">file buffering</a> on MSDN.</p> <p>Opening the file with the flag <code>CFile::osNoBuffer</code>, or passing the flag <code>FILE_FLAG_NO_BUFFERING</code> to <code>CreateFile</code>, is quite a special way of writing to the file. It requires that all buffers you use to write to the file are aligned to a sector boundary in memory, and also that you only write an integer multiple of the sector size. Unless you've taken special steps to align the buffer you're passing (which you haven't here), and also written at least e.g. 512 bytes, it's unlikely that it will work unless the device silently ignores your flag. I think you possibly didn't notice that <code>WriteFile</code> returned an error code instead of throwing an exception.</p> <p>I would ask: why are you specifying this flag at all? Its use is quite specialized, and if you're just doing normal everyday file I/O, like writing a text file, then you should <em>not</em> specify this flag. It probably slows down your program, and makes it more complicated as well. I also recommend that you remove <code>CFile::osWriteThrough</code>.</p> <p>Just so you know: the use of <code>FILE_FLAG_NO_BUFFERING</code> is almost exclusively for things writing a massive amount of data that must go directly to disk, such as real-time data logging or video recording applications. <code>FILE_FLAG_WRITE_THROUGH</code> is used for things like database log files that must be flushed after every write for transactional correctness. Disabling these caches and buffers in other cases generally slows down your program.</p> <p>Here's <a href="http://blogs.msdn.com/b/oldnewthing/archive/2010/04/14/9995509.aspx" rel="nofollow">another discussion</a> of someone with the same problem (though they were using .NET, not C++).</p> <p>Edit: Thanks for mentioning the size requirement Daryl.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload