This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: filebuf.in_avail
- To: libstdc++ at sourceware dot cygnus dot com
- Subject: Re: filebuf.in_avail
- From: Dietmar Kuehl <dietmar_kuehl at yahoo dot com>
- Date: Wed, 7 Jun 2000 19:28:51 -0700 (PDT)
Hi,
--- brent verner <brent@rcfile.org> wrote:
> my reading of this is that in_avail() should return -1 when EOF ...
Correct.
> I can't see where it _could_ return 0;
It will often return '0': The intentation of 'in_avail()' is to
determine how many characters can be read without running the risk of
blocking. Once a file is exhausted and the position sits at the
[current] end of the file, 'in_avail()' will return '0' but not EOF!
The file, even a non-special file might grow. Thus, if a user read
right to the end but not beyond, EOF is not reached and 'in_avail()'
returns '0'. Actually, 'in_avail()' might even return '0' in the middle
of a file, namely when hitting the boundary of a buffer: It is QoI
issue whether 'showmanyc()' tries to be clever and determine a better
approximation than what is known to the stream buffer any.
It is important to note that there is a difference between EOF and
sitting at the end of a file: After EOF is reached, no character will
be available from the stream. If a stream sits currently at the end of
the file, there may be characters available in the future.
=====
<mailto:dietmar_kuehl@yahoo.com>
<http://www.dietmar-kuehl.de/>
__________________________________________________
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com