eof(), bad(), good() functions aren't detected by autocomplete

ε祈祈猫儿з 提交于 2019-12-13 15:17:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!