G
Guest
Hi!
I'm having trouble reading text lines from a file describing the levels
for a simple game I'm creating.
Inside the function that reads the content of the file there is a loop
that basically looks like this
ifstream file("levels\\level1.txt");
string line;
getline(file, line);
while(!file.eof()){
...
getline(file, line);
}
The first part of the level file looks like this
#configs
levels/objectconfig.txt
#mappings
....
I've tried reading the content of the file using a test application I
wrote just to try to find the bug but I get the same problem. When it's
time for the program to read the #mappings line the debugger displays
the content of the line variables as ??? or a square symbol. If I
remove the path line in the middle of the two lines above everyting
works ok. I've tried using \\ and \ instead of / but that didn't help.
The strange thing is that if I unroll the loop and create something
like
ifstream file("levels\\level1.txt");
string line;
getline(file, line);
getline(file, line);
string line2;
getline(file, line2);
line2 will contain #mappings after the call to getline.
I'm using Visual Studio .NET 2003.
Any ideas?
/M
I'm having trouble reading text lines from a file describing the levels
for a simple game I'm creating.
Inside the function that reads the content of the file there is a loop
that basically looks like this
ifstream file("levels\\level1.txt");
string line;
getline(file, line);
while(!file.eof()){
...
getline(file, line);
}
The first part of the level file looks like this
#configs
levels/objectconfig.txt
#mappings
....
I've tried reading the content of the file using a test application I
wrote just to try to find the bug but I get the same problem. When it's
time for the program to read the #mappings line the debugger displays
the content of the line variables as ??? or a square symbol. If I
remove the path line in the middle of the two lines above everyting
works ok. I've tried using \\ and \ instead of / but that didn't help.
The strange thing is that if I unroll the loop and create something
like
ifstream file("levels\\level1.txt");
string line;
getline(file, line);
getline(file, line);
string line2;
getline(file, line2);
line2 will contain #mappings after the call to getline.
I'm using Visual Studio .NET 2003.
Any ideas?
/M