I was working on some advanced debuggery last night (to cancel out some of Marcel's blatant douchebaggery when it comes to loading levels).
At the moment, individual loading functions are using C-style text file manipulation:
Code: Select all
FILE *file = fopen("file.txt", "r");
That's completely sweet and all, and I can test the stream simply by:
Code: Select all
if(!file) printf("Marcel screwed something up.\n");
Now the overall debug system uses C++ fstreams (because it's newer, my older code was all C-style).
I'd like to achieve essentially the same thing:
Code: Select all
ifstream file("file.txt");
if(!file.good()) cout << "Marcel screwed something up.\n";
The problem is that the program shits itself when the file is instantiated, and doesn't even get to the good() or bad() tests (which I do believe is the correct way to check the status of the filestream.)
I'd like to know how I'd make the program continue if the file cannot be openned.