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
|