Может ли кто-нибудь сказать мне, почему этот метод не будет компилироваться?
void Statistics::readFromFile(string filename)
{
string line;
ifstream myfile (filename);
if (myfile.is_open())
{
while (! myfile.eof() )
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
}
else cout << "Unable to open file";
}
Должно работать, да? Тем не менее, я всегда получаю следующее сообщение об ошибке:
Line Location Statistics.cpp:15: error:
no matching function for call to
'std::basic_ifstream<char, std::char_traits<char> >::
basic_ifstream(std::string*)'
любая помощь будет принята с благодарностью.