我有:
string filename:
ifstream file(filename);
编译器抱怨ifstream文件和字符串不匹配。我需要将文件名转换为其他内容吗?
这是错误:
error: no matching function for call to ‘std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream(std::string&)’
/usr/include/c++/4.4/fstream:454: note: candidates are: std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]