If your file consists of simple lines where one line is all of the information you need to read one record then all you have to do is open the file for reading, open a second file for writing and read one line at a time. Do your processing on that line, save it to the out file and read another from the in file.
If you need to read several lines to get one record then it would be best to wrap your data in a struct. Say you have one line with several items that need to be extracted and two more lines that are taken as a whole but must be kept with the data on the first line, you'd use a struct something like this:
The you read from the file with cin.getline() and extract the items of the first line with sscanf. When you're done processing, print out the data in the struct to your out file.