'terminate called after throwing an instance 'std::__ios_failure'
In Ubuntu20.04 gcc9.4.0
`void read_txt_config(const std::string &path) { std::cout << std::endl << "Reading configuration file: ";
std::ostringstream batch_out;
batch_out
<< path
<< "config.txt";
std::string str_temp = batch_out.str().data();
std::ifstream fin;
fin.exceptions(std::ios::failbit | std::ios::badbit);
fin.open(str_temp.c_str());
if (!fin.good())
{
std::cout << " reading failed, there is no config.txt, the program will use the default param_nameeters. " << std::endl;
}
else
{
...
...
}
fin.close();}
when the code run to
fin.close();
I got
terminate called after throwing an instance 'std::__ios_failure' what(): basic_ios::clear: iostream error Aborted(core dumped)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|