问题
This code block:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main () {
string line;
ifstream myfile ("example.txt");
if (myfile.is_open())
{
while ( myfile.good() )
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
}
else cout << "Unable to open file";
return 0;
}
taken from here, compiles and runs well, but the good() function isn't recognized by my IDE (Qt) when I try to write it by hand and use autocomplete. Can anyone tell me why?
Thank you
P.S. I use the mingw compiler, if that helps.
来源:https://stackoverflow.com/questions/16569651/eof-bad-good-functions-arent-detected-by-autocomplete