Put some more debug lines in it and do some more error checking.
I'm sure if you do that you will find the error yourself:
Code:
int LoadLoc()
{
char desc[256];
ifstream b_file;
cout << "LoadLoc: loc = " << loc << endl;
switch(loc)
{
case 1:
// open file for reading, fails if file does not exist
b_file.open("0.txt", ios::nocreate);
if(b_file)
{
b_file.getline(desc, 256);
cout << desc;
b_file.close();
}
else
{
cout << "Error: unable to open file 0.txt" << endl;
return -1;
}
break;
default:
cout << "Error: unknown location(" << loc << ")" << endl;
return -2;
break;
}
return 0;
}