eof()-检查文件读取是否达到文件末尾



std::ios::eof

bool eof() const;
Check whether eofbit is set

Returns true if the eofbit error state flag is set for the stream.

检查eofbit被设置,如果被设置则返回 true

 This flag is set by all standard input operations when the End-of-File is reached in the sequence associated with the stream.

如果与输入流相关联的序列达到了End-of-File标志,任何标准的输入操作都可以将此标志设置为eofbit


Parameters (参数)

none

没有参数


Return Value(返回值)

true if the stream's eofbit error state flag is set (which signals that the End-of-File has been reached in an input operation).
false otherwise.

如果流的错误标志 eofbit 被设置,则会返回true(标明该输入操作已经达到了End-of-File标志),否则返回false。


Data races(数据竞争)

Accesses the stream object.
Concurrent access to the same stream object may cause data races.

获取流类对象

针对相同流的操作可能会引发数据竞争。


Exception safety

Strong guarantee: if an exception is thrown, there are no changes in the stream.

如果抛出异常,流类对象并未发生任何改变。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值