I am trying to write back to the beginning of a file using the following:

Code:
 outfile.open(fileName, ios::in|ios::nocreate)
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.