Quick help please
I am writing some data to a file but I do not know the information required in the third line until after the file is completed
is there a way to point the ofstream back to the beginning of the file so that i can edit it accordingly?
In some cases the file can be over a billion lines long so the information cannot be held in memory
My current code closes the file and then opens it again to edit the file
The lines I replace are exactly the same length
ofstream file_out(output_file);
//lots of output to file_out
file_out.close();
fstream file;
file.open(output_file);
file << "data file\n\n";
file << No_atoms << " atoms\n";
I hope I have given enough information
Thank you for your time