I'm sorry I stated that out of context. I need to use a file as both a ifstream and an ofstream. This is were I have become confused because I don't believe you can do both at the same time.
I agree, a better method would be to read the data into an array, forget about the file and work with it from there. Then you just dump the data to the file when you're done with it. Hitting the disk is always TDS.