No matter what I try, I cant get the following code to work correctly.
ifstream inFile;
inFile.open("sampleplanet");
cout << (inFile.good()); //prints a 1
int levelLW = 0;
int numLevels = 0;
inFile >> levelLW >> numLevels;
cout << (inFile.good()); //prints a 0
at the first cout << (inFile.good());, it prints a 1 and at the second a 0. Which tells me that the file is opening correctly, but inFile is failing as soon as read in from it. The file has more then enough lines/characters, so there is no way I have tried to read past the end of the file by that point.
File contents:
8
2
#level 2
XXXXXXXX
X......X
X..X..XX
X.X....X
X..XX..X
XXXX...X
X...T..X
XXX..XXX
#level 1
XXXXXXXX
X......X
X..X.XXX
X.X..X.X
X..XX..X
X......X
X^....SX
XXX.^XXX