Input and Output concurrently
Hi,
I would like to know if it is possible to read a file and write to the same file at the same time.
For example, if I have
Code:
#include <fstream>
// and other headers
using namespace std;
string temp_string;
char result;
fstream studfile;
studfile.open("student.dat", ios::in | ios::out); // Is this correct?
while (!studfile.eof() ) {
getline ( studfile, temp_string);
studfile << "Results: " << result << endl;
}
Is there any way to manipulate a .dat file while reading it?
I've checked quite a couple of sites, but there are only solutions for binary files..
Thanks! =)