I am reading an input file from the command line.
int main(int argc, char **argv)
{
Scene myScene;
string filename = argv[1];
myScene = Parser(filename);
...
}
from another file I use the parser function which is declerated like that;
Scene Parser(string filename)
{
string line;
ifstream myfile (filename.c_str());
...
return scene;
}
I am getting the error; terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct null not valid
Program received signal SIGABRT, Aborted.
I have searched the error. I think it is because of these lines. But I cannot find the actual reason. Can anybody help me?
argv[1]if you don't checkargc > 1beforehand.