}//关闭文件ifs.close(); return true; } 运行报错: error: no match for 'operator>>' (operand types are 'std::ofstream{aka std::basic_ofstream<char>}' and 'char')ifs >> ch; 分析和解决: 上面的代码是用ofstream打开文件,即写入的方式,但是后面却用它来读取文件ifs >> ch,将ofstream换成输入...
ofstream 是写文件流,如果你的本意是想把bookname写入off里,应该写成 off<<bookname.>>是读文件时的符号
报错: no matching function for call to ‘std::basic_ofstream<char>::open(std::__cxx11::basic_stringstream<char>::__string_type, const openmode&)’ outfile_fit.open(ss.str(), ios::out); 1 2 解决办法: stringstream ss; ss << root_path << setw(4) << setfill('0') << run_...