Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

kbhit() and getch() in gnu C++

36 views
Skip to first unread message

Gary Kabitzke

unread,
Feb 18, 1997, 3:00:00 AM2/18/97
to

The DEC 1000 we have at school uses vt100s for stdin and stdout. The
only functions that I can find to get data from the vt100 are like getc(),
getline,.... These all require that you press return before the key is
available for processing by a program. I have tried to write functions
like kbhit() and getch(), which are available on a PC platform, but I have
not had much luck. I have looked directly at stdin, but no chars get loaded
into the stdin buffer until a function like getc(stdin) is executed.

If anybody has the solution of how to input a key from a terminal,
including white space, without having to press return, please forward the
info.

Thanks

Gary

Dave Steffen

unread,
Feb 18, 1997, 3:00:00 AM2/18/97
to

Gary Kabitzke (gaka...@meqlan1.remnet.ab.com) wrote:
[snip]

> available for processing by a program. I have tried to write functions
> like kbhit() and getch(), which are available on a PC platform, but I have
> not had much luck. I have looked directly at stdin, but no chars get loaded

I believe that kbhit() and friends are specific to Borland's
C/C++ compilers. Doing this kind of thing on a Unix box (Xwindows or
otherwise) takes a bit more doing... check out the "curses"
library. I've heard of a C++ library called "Drat" but haven't tried
it out.

--------------------------------------------------------------------------
Dave Steffen Wave after wave will flow with the tide
Dept. of Physics And bury the world as it does
Colorado State University Tide after tide will flow and recede
stef...@lamar.colostate.edu Leaving life to go on as it was...
- Peart / RUSH
"The reason that our people suffer in this way....
is that our ancestors failed to rule wisely". -General Choi, Hong Hi

0 new messages