I try to open a file in a function in a class:
void openFile(){
inputFile.open(inputFilename.c_str());
if (inputFile.is_open()){
inputFile.read(buffer, skipAtBegin);
} else {
cerr << "Cannot open file: " << inputFilename << endl;
exitNow();
}
}
In main() i would just return 1, but how can i do this in a sub-sub-function-class the best/simplest way??
Return 1 all steps up to main?
Use ecxeptions?
Any exit()
commands?
Usually there are three Options:
Hope someone would come up with other options.