该代码块:
#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;
}
取自here http://www.cplusplus.com/doc/tutorial/files/,编译并运行良好,但是good()当我尝试手动编写并使用自动完成功能时,我的 IDE (Qt) 无法识别该函数。谁能告诉我为什么?
谢谢
附:我使用 mingw 编译器,如果有帮助的话。
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)