QUOTE(gabehabe @ 18 Aug, 2008 - 03:44 PM)

Search google for a C++ ifstream tutorial.
Basically, you would want to open the file, read it in, line by line, outputting each line as you go. Then close the file.
Simple!
EDIT:Wait, are you using C or C++ ?
If you're using C, just search Google for a C *FILE tutorial.
ANOTHER EDIT:Tell me if you're using C or C++ and I'll explain it

hey man yh i am using c++ i have got it working but i have a problem when writing to a file, basically, the file is a scoreboard, so everytime you win, it writes "win" in the file and "lose" for when you lose and "tie". my problem is, if the file contains "win" on the first line, an i win again, it is meant to write:
win
win
but instead it just over writes the first one, is there anyway to make it go to the end before writing.
this is the function which is meant to update the score.txt
CODE
void decideWinner(){
ofstream scorefile ("score.txt");
char winner = checkWinner();
if(noOfChoices<9){
if(winner == 'X'){
if(menuOption==1){
cout << "You won." << endl;
if (scorefile.is_open()){
scorefile << "\nwin";
}else{
cout << "Unable to open score file\n";
}
}else if(menuOption==2){
cout << "Player1 won." << endl;
cout << "Player2 lost." << endl;
}
noWinner=false;
}else if(winner == 'O'){
if(menuOption==1){
cout << "You lost." << endl;
if (scorefile.is_open()){
scorefile << "\nlose";
}else{
cout << "Unable to open score file\n";
}
}else if(menuOption==2){
cout << "Player2 won." << endl;
cout << "Player1 lost." << endl;
}
noWinner=false;
}else{
noWinner=true;
}
}else{
cout << "Its a tie." << endl;
if (scorefile.is_open()){
scorefile << "\ntie";
}else{
cout << "Unable to open score file\n";
}
noWinner=false;
}
scorefile.close();
}