17 void open_file( std::fstream& ofs, std::string& filename, std::ios::openmode mode )
21 ofs.open( filename.c_str(), mode );
23 catch ( std::exception& ex )
25 std::string message =
"Error opening file " + filename +
": " + ex.what();
26 throw std::runtime_error( message );
29 void open_file( std::ofstream& ofs, std::string& filename, std::ios::openmode mode )
33 ofs.open( filename.c_str(), mode );
35 catch ( std::exception& ex )
37 std::string message =
"Error opening file " + filename +
": " + ex.what();
38 throw std::runtime_error( message );
42 void open_file( std::ifstream& ifs, std::string& filename, std::ios::openmode mode )
46 ifs.open( filename.c_str(), mode );
48 catch ( std::exception& ex )
50 std::string message =
"Error opening file " + filename +
": " + ex.what();
51 throw std::runtime_error( message );
void open_file(std::fstream &ofs, std::string &filename, std::ios::openmode mode)