writing back to the file
I am trying to write back to the beginning of a file using the following:
Yes it writes to the beginning of the file but it seems to overwrite some of the information already there. How can I prevent this from occuring.
You can't just insert new data at the beginning of a file. Naturally anything you write will overwrite what's already there. If you want to insert something at the beginning of a file then you'll need to either use a dynamic data structure in memory to work with the file, or write what you want to a temporary file, then append the contents of the file to the temporary, then copy the temporary back to the original file.
Thanx for that. Had no idea that was the case