Sep 25, 2010 at 1:16am UTC
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 Sep 25, 2010 at 1:16am UTC
Sep 25, 2010 at 3:00am UTC
Why don't you open it once and just check if (filei.is_open())
?
Sep 25, 2010 at 3:05am UTC
Oh...thanks...should have saw that...
Sep 25, 2010 at 5:46pm UTC
yeah good job...
i was wondering what is your program ( all the program ) suposed to do ??
Oct 6, 2010 at 11:01pm UTC
It's a project me and 3 other programmers have been working on for 5 years.
Last edited on Oct 6, 2010 at 11:02pm UTC