사용자가 읽고 싶은 파일을 묻는 프로그램을 만들고 있는데 myfile.open(fileName)
을 시도하면 오류가 발생합니다. " 해당 회선에서 std::basic_ifstream<char, std::char_traits<char> >::open(std::string&)'
에 대한 호출과 일치하는 기능이 없습니다. C의 이전 버전에문자열을 매개 변수로 사용하는 ifstream :: open() 함수
string filename;
cout<<"Enter name of file: ";
cin>>filename;
ifstream myFile;
myFile.open(filename); //where the error occurs.
myFile.close();
annoyingly, cplusplus.com은 C++ 11 이후'open'은'string' 과부하가 없다고 언급하지 않지만 cppreference.com *은 분명히 그렇게합니다. – us2012