Skip to content
Snippets Groups Projects
Commit ef1c885f authored by timeo's avatar timeo
Browse files

Ajout verification ouverture fichier. Ne s execute pas si le fichier n existe pas

parent 3117b041
Branches
No related tags found
No related merge requests found
......@@ -18,6 +18,10 @@ void parseFile(string namefile) // Enregitrement du fichier dans une variable
string line;
ifstream myfile;
myfile.open(namefile);
if ((myfile.rdstate() & ifstream::failbit ) != 0 ){
std::cout << "erreur ouverture" << std::endl;
exit(0);
}
if (myfile.is_open())
{
while (getline(myfile, line))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment