Impossible d'ouvrir un fichier C++
Salut.
Je ne parviens pas à ouvrir un fichier en c++ avec ce code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
//Ne fonctionne pas. (pas normal!)
/*std::ifstream file(path.toStdString());
std::string line;
while(getline(file, line)) {
QString s(line.c_str());
std::cout<<s.toStdString()<<"-"<<keyword.toStdString()<<std::endl;
if (s.contains(keyword))
contains = true;
}
}
file.close();*/ |
Ce code ne compile même pas :
Code:
1 2 3 4
|
C:\Users\Laurent\Développement\Projets-c++\RecherchePDF\mainwindow.cpp:87: erreur : no matching function for call to 'std::basic_ifstream<char>::basic_ifstream(std::string)'
std::ifstream file(path.toStdString());
^ |