我正在尝试制作一个程序来询问他们用户想要读取的文件,当我尝试时myfile.open(fileName)
我得到错误:“没有匹配的函数调用std::basic_ifstream<char, std::char_traits<char> >::open(std::string&)'
”在该行。
string filename;
cout<<"Enter name of file: ";
cin>>filename;
ifstream myFile;
myFile.open(filename); //where the error occurs.
myFile.close();