[Baypiggies] File IO question
mech422 at gmail.com
Tue Jul 25 17:51:18 CEST 2006
> On 7/25/06, Ken Seehart <ken at seehart.com> wrote:
> > My question is this: If I write a single byte to a file that contains
> > exactly one byte, can I be sure that a power outage during the write
> > will not render the file unreadable?
Given its a binary switch - the file contents are immaterial.
You could simply use the (non-)existance of the file as the status indicator.
Also, in these situations, its common to write the indicator LAST, after all
updates have completed normally. So if the power fails, etc - you can
the original known-good copy.
More information about the Baypiggies