I'm glad you figured it out.
>Sergey,
>You are absolutely right. There was no problem with that code and the file wasn't corrupted.
>There was a function called close data which was called after all of the data had been written to the file. In the header it said it wrote a summary to the end of the file but it didn't it wrote it to the top overwriting the first line.
>It probably used to write to the end of the file but some c*** had changed it and not altered the desription in the header.
>Other peoples code. When they bother annotating it they just mislead you.
--sb--