help with saving and reading from file

Here is psuedo code of what im trying to do
1
2
3
4
5
6
7
8
9
10
11
if file highscore.txt does not exist
   create file highscore.txt
   write highscore in highscore.txt

   if score > highscore
      remove all text in highscore.txt
      write score in highscore.txt
else//it does exist
   if score > highscore
      remove all text in highscore.txt
      write score in highscore.txt


i am very confused with the methods and when to use ofstream and ifstream.
I suggest you start with the following tutorial:

http://www.cplusplus.com/doc/tutorial/files/

Topic archived. No new replies allowed.