Topic: various questions on cin (and istream in ge


Author: ncm@netcom.com (Nathan Myers)
Date: Tue, 28 Feb 1995 01:55:11 GMT
Raw View
In article <3hthgh$lqb@engnews2.eng.sun.com>,
Steve Clamage <clamage@Eng.Sun.COM> wrote:
>In article naf@sashimi.wwa.com, mikeg@sashimi.wwa.com (Michael N. Goldshteyn) writes:
>>I would like to know if it is possible to ask cin whether a character is
>>waiting to be processed and the pull that character in without having to
>>wait for a CR.

>This is outside the realm of iostreams (or C stdio, for that matter).

Actually, a new member streambuf::inavail() was recently approved.
I don't have the WP handy at the moment, but this seems like what
you want.  A related function, showmanyc() (that's s-howmany-c, not
show-many-c :-) might be useful too.

Nathan Myers
myersn@roguewave.com




Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 15 Feb 1995 18:34:57 GMT
Raw View
In article naf@sashimi.wwa.com, mikeg@sashimi.wwa.com (Michael N. Goldshteyn) writes:
>I would like to know if it is possible to ask cin whether a character is
>waiting to be processed and the pull that character in without having to
>wait for a CR.

This is outside the realm of iostreams (or C stdio, for that matter).

This is an operating systems issue, and you have to look for lower-level
solutions. MSDOS-based systems often have something like <conio.h> which
may provide what you need. Unix systmes have stty, or sgtty, or similar
things. VAX/VMS has yet another mechanism.

The comp.lang.c FAQ talks about this issue in more detail.

---
Steve Clamage, stephen.clamage@eng.sun.com