首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

c++ 文件操作 good() 与 eof()的差别?

2013-12-22 
c++ 文件操作 good() 与 eof()的区别???c++ 文件操作 good() 与 eof()的区别ifstream filefile.good() 与

c++ 文件操作 good() 与 eof()的区别???
c++ 文件操作 good() 与 eof()的区别
ifstream file;
file.good() 与 file.eof() 区别
求高手指教!
[解决办法]
good()表示文件流是否正常,eof表示文件流是否到结束了
[解决办法]

good() 等价于 !(bad() 
[解决办法]
 eof() 
[解决办法]
 failed())

[解决办法]
Check if the state of the stream is good for i/o operations.

The function returns true if none of the stream's error flags (eofbit, failbit and badbit) are set.

Notice that this function is not the exact opposite of bad(), which only checks whether the badbit error flag is set.

The error flags can be checked independently by using any of the member functions eof, fail and bad.

The value returned by this function is the same as the result of evaluating:
(rdstate() == 0) 

数据流处理的一种标识

热点排行