如何测试 std::ifstream 是否达到 EOL

How to test if std::ifstream reached EOL

我有一个 std::ifstream 文件,其中包含多行 space 分隔值。

有没有办法知道我在阅读 std::ifstream 时是否到达了一行的末尾?

如果我猜到你目前正在阅读它

没有,

 ins >> stuff;

丢弃空格。

你想做一个

std::getline(ins, line_string);

并逐行处理。