Date: Thu, 18 Sep 2025 07:47:28 +0100
On Thu, 18 Sept 2025, 01:26 Thiago Macieira via Std-Proposals, <
std-proposals_at_[hidden]> wrote:
> On Wednesday, 17 September 2025 12:26:20 Pacific Daylight Time Jonathan
> Wakely
> via Std-Proposals wrote:
> > You don't have to call gcount though. istream::read always reads the full
> > count, unless it encounters EOF or an error. So generally you want to
> check
> > "was this successful?" and not "how many characters did it read, and was
> > that equal to the number I asked for?"
>
> istream should be able to have short reads when not enough data is
> available,
> but hasn't reached EOF (no more data will ever be available). Imagine a
> simple
> in-process pipe where an istream is tied to an ostream: if you try to read
> more than what the ostream has written, you won't get everything. But that
> is
> not an error.
>
That's what istream::readsome is for. istream::read will block until more
data is available.
std-proposals_at_[hidden]> wrote:
> On Wednesday, 17 September 2025 12:26:20 Pacific Daylight Time Jonathan
> Wakely
> via Std-Proposals wrote:
> > You don't have to call gcount though. istream::read always reads the full
> > count, unless it encounters EOF or an error. So generally you want to
> check
> > "was this successful?" and not "how many characters did it read, and was
> > that equal to the number I asked for?"
>
> istream should be able to have short reads when not enough data is
> available,
> but hasn't reached EOF (no more data will ever be available). Imagine a
> simple
> in-process pipe where an istream is tied to an ostream: if you try to read
> more than what the ostream has written, you won't get everything. But that
> is
> not an error.
>
That's what istream::readsome is for. istream::read will block until more
data is available.
Received on 2025-09-18 06:47:48