Thread: Help
View Single Post
  #2 (permalink)  
Old October 30th, 2003, 07:18 PM
Sebastiani Sebastiani is offline
Registered User
 
Join Date: Aug 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

A file is like an array. You can't simply 'insert' bytes in the middle. The easiest approach is as follows:

1) create a temporary file.
2) write the first set of bytes of the database to the temp file.
3) write the new set of bytes to the temp file.
4) write the final set of bytes of the database to the temp file.
5) if no errors have occured, delete the original and rename the temp file.

- Sebastian Garth

"The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." - Donald Knuth
Reply With Quote