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)

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum