views:

95

answers:

0

I'm designing a system that will write time series data to a file. The data is blocks of 8 bytes divided into two 4 bytes parts, time and payload.

According to MSDN the WriteFile function is atomic ( http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx ), if the data written is less then a sector in size.

Since the file will only contain these blocks (there is no "structure" of the file so its not possible to reconstruct a damaged file), added one after each other, its vital that the whole block, or nothing is written to the file at all times.

So the question is, have I understood it correctly that a writefile less then a sector in size is alway written completely to disk or not written at all, no matter what happens during the actual call to writefile ?