I was going for something like this -
As you can see, there's no need to deal with the position inside the file, as you read the entire file, shove the new data in and then write all of it back.
Darin's method is probably a lot more robust, though.
___________________
Try to take over the world!