So you read the portion of the file that you want to preserve using an ifstream. Now close this ifstream, and using the same file name create an ofstream. If you don't provide the optional third parameter to your ofstream creation it will erase the file contents when it open the file. Now just write the old information to this ofstream.
Code:
ifstream ins("MyFileName); // Open a file for reading.
// Check that it opened correctly and read the information you want to preserve into vectors.
ins.close(); // Close the file.
ofstream out(MyFileName); // Open a file for writing, erase current contents.
// Check that it opened correctly and write the new information.
Jim