getchar()

David Ebbo dsebbo at dahlia.uwaterloo.ca
Sat Mar 9 11:04:06 AEST 1991


In article <1991Mar6.165835.10237 at cs.mcgill.ca> storm at cs.mcgill.ca (Marc WANDSCHNEIDER) writes:
>    Then is there ANY way that I can have sort of "HOT KEYS" ie the user
>just hits a  key, and then the computer recognizes that a key has been hit
>and the key is sent to some variable...?  (Using MSDOS...)
>
>    Thanks for the help.

Surely there is a way, but it's not portable.
On Turbo C++ and MS C (and quick C I guess), you can use either getch() or
getche().  The difference is that getche() echos the characters you type, 
while getch() doesn't.
You should include conio.h if you're going to use those functions.

Hope this helped,
David Ebbo.



More information about the Comp.lang.c mailing list