Hey all, I was wondering could someone help me on writing a file to a notepad.exe file.
What i need help on is i have a gam and i want to record how many times the player 1 & 2 has won lost or had a draw.
How would i go about coding that? Also if one the players who played before was on how could i increase their score again?
char str[100];
ifstream f_myfile("test.txt");
// check that file opened OK
if(!f_myfile)
{
cout << "ERROR: can't open ";
cout << "test.txt\n";
exit(1);
}
// note use of the readahead structure
f_myfile.getline(str, 100);
while(!f_myfile.eof())
{
cout << str << "\n";
f_myfile.getline(str, 100);
}
f_myfile.close();
system("pause"); }
Thats what i got so far and that shows the file but i assume i need another bit of code for putting stuff in it?
Anyone able to help me plz?