下图中程序中的while(infile.good())是什么意思?good()是infile的函数吗?
展开全部
infile.good()
good() 表示文件正常,没有读写错误,也不是坏的,也没有结束
good() 是 istream 的方法,也是 ifstream 的方法
infile应该是文件流
cout << ( x.rdstate( ) & ios::badbit ) << endl;
cout << ( x.rdstate( ) & ios::failbit ) << endl;
cout << ( x.rdstate( ) & ios::eofbit ) << endl;
bool good( ) const;
1 or true if rdstate == goodbit (no state flags are set), otherwise, 0 or false.
boolalpha specifies the format of a bool variable.
The member function returns true if rdstate == goodbit (no state flags are set).
good() 表示文件正常,没有读写错误,也不是坏的,也没有结束
good() 是 istream 的方法,也是 ifstream 的方法
infile应该是文件流
cout << ( x.rdstate( ) & ios::badbit ) << endl;
cout << ( x.rdstate( ) & ios::failbit ) << endl;
cout << ( x.rdstate( ) & ios::eofbit ) << endl;
bool good( ) const;
1 or true if rdstate == goodbit (no state flags are set), otherwise, 0 or false.
boolalpha specifies the format of a bool variable.
The member function returns true if rdstate == goodbit (no state flags are set).
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询