> > A method I have used keeps two copies of the data and a pointer byte. > > I write alternately to the one or the other. I first write the data and > > then write the single pointer byte to indicate which of the entries > > contain the most recent info. This method makes sure that the data you > > read is always valid (although it might not be the newest data). > > Is there not a danger with this method that the pointer location > could get corrupted if it is being written at the same time that > the power is being removed? Well, if you only look at one bit of the pointer this shouldn't pose a problem. Since the pointer byte will only [usually] be written when both copies of the data are valid, it won't matter what value is read for the pointer in those cases. Even the annoying odd cases (e.g. one copy of the data is corrupt when the system starts up) can be dealt with safely if the data is written to the corrupt page (fixing it) before the pointer is written for the first time.