This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: unbuffered input

[let's move this off of gcc@ to libstdc++@, followups set]

On Tue, May 21, 2002 at 06:48:07PM -0400, Phil Edwards wrote:
> In your first message you said you'd tried setbuf, by which I assume you mean
>     cin.rdbuf()->pubsetbuf(0,0);
> What happened?

Actually, looking at basic_filebuf::setbuf(), I bet I can answer this:  Nothing.

We're supposed to be checking "whether any I/O has occurred on the stream,"
according to the standard, but we're actually only checking whether the
buffer is open.  And for cin's buffer, that will always be true.

So you're probably seeing a single character in the buffer all the time,

    "david rasmussen"  "c"                      "openhagen, denmark"



If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams

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