为什么下面的程序卡在无限循环中?无限循环while read stdio.h
int main()
{
string fname = "C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\include\\stdio.h";
char line[985];
ifstream file(fname.c_str());
if(file == NULL)
{
cout<<"unable to open";
exit(0);
}
while(!file.eof())
{
file.getline(line,'\n');
cout<<line<<'\n';
}
}
stdio.h中无关这个问题 –