0

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?

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by Ancient Dragon
0

anyone?, or can someone point me to an example? i've tried look for one but cant find any that does what i'm after.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.