This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: cin/streambuf-problem
- To: "R. Sinoradzki" <sinoradz at student dot uni-kl dot de>
- Subject: Re: cin/streambuf-problem
- From: Carlo Wood <carlo at alinoe dot com>
- Date: Sat, 19 May 2001 19:24:13 +0200
- Cc: libstdc++ at gcc dot gnu dot org
- References: <3B0599E7.9604B8FE@student.uni-kl.de>
On Fri, May 18, 2001 at 11:53:43PM +0200, R. Sinoradzki wrote:
> I have this little program. It does not behave as
> expected with gcc-3.0 and it's stdlib.
> If I type for example "hello" the loop runs 5 times,
> before the next 'cin' because 'cin.rdbuf()->in_avail()'
> reports only 1.
>From the top my head (I am not at home right now, but telnetted
into my PC (no GUI)), streambuf::in_avail() doesn't return the
number of buffered characters, but only the number that can
be read quickly (the current contiguous ammount in the get area?).
I even seem to remember that the default implementation is currently
to always return 1. In other words: I might be wrong but I think you
shouldn't use in_avail(), it means something else then you (apparently)
think it means.
--
Carlo Wood <carlo@alinoe.com>