Peter Stathakos - Stack Of Toast

Microsoft, .NET and Life in General

  Home  |   Contact  |   Syndication    |   Login
  367 Posts | 3 Stories | 663 Comments | 473 Trackbacks

News


Technorati Profile

Email: pstathakos@hotmail.com
Phone: 425.753.2488
MSN: pstathakos@hotmail.com
Skype: Add me to Skype

Chipis & Pellitos. Get yours at bighugelabs.com/flickr



My guestmap


Locations of visitors to this page

Creative Commons License
This work is licensed under a Creative Commons License.

Archives

Post Categories

Image Galleries

Links

Although we are (usually) careful about using transactions when working with databases, too often we assume that data writes to a file will always succeed. This is not always the case, and especially these days when chunks of XML are being written to files it is especially important to verify that the writes to the files are atomic operations. That is, that either everything you intend to be written to the file is actually written, or nothing is. There should be no case where data is cut off.

From Adi Oltean's excellent blog comes this post about how to do atomic writes to a file. I was interested to learn that some of the assumptions that I held about files (and especially about how the StreamWriter class works) are wrong. So thanks to Adi for the clarification.

 

posted on Friday, December 30, 2005 1:30 PM