in reply to inserting/deleting file data

I think you're going to have to post some code for us to be able to help you. Most of us aren't psychics.

If you post the part of the code that writes to the flatfile, people can look it over and report anything that might be generating those null bytes at the end of your file.

Update: Judging by the replies below, I apparently underestimated the number of psychics around here ;). jeffa's hunch wrg pack might well be spot on.

CU
Robartes-