A *LOT* of trouble!!

I have had SOOOOO much trouble with this piece of code. It won't check the file and then take the text from the file: (take note this is only part of the program)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
           cin >> filename;
           
           filei.open (filename.c_str());
           filei.seekg (ios::beg);
           filei >> file_check;
           filei.close();
           if (file_check == 1)
           {
                          filei.open (filename.c_str());
                          filei.seekg (1, ios::beg);
                          filei >> fileload;
                          filei.close();
           }
           else
           {
               cout << "ERROR...FILE DOSN'T EXIST...RESTARTING";
           }

Last edited on
Why don't you open it once and just check if(filei.is_open()) ?
Oh...thanks...should have saw that...
yeah good job...
i was wondering what is your program ( all the program ) suposed to do ??
It's a project me and 3 other programmers have been working on for 5 years.
Last edited on
Topic archived. No new replies allowed.