in reply to Writing to files

The short answer is, no, not as easily as you might think. Unlike say, word processing, you can't just go to the start of the file, hit the 'insert' key, and add a string: file editing is 'overwrite' mode only. There are two basic ways to do it, and both require you to read in all the data from the file at some point.

I prefer the second way myself, but whatever floats your boat - as long as it gets the job done!