This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: cin/streambuf-problem


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>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]