Mail Archives: djgpp/1993/10/28/05:23:50
>
> I'd like to read characters from the keyboard without waiting for <RETURN>
> or if possible without waiting at all. The pressed key shouldn't be echoed
> to the screen (like getche() in Turbo)
>
#include <pc.h>
This include file defines a.o. the prototypes for the following functions:
int kbhit(void);
int getkey(void); /* ALT's have 0x100 set, 0xe0 sets 0x200 */
int getxkey(void); /* ALT's have 0x100 set */
getkey() does what you want, getxkey() is for reading extended keys.
Read the comments in <pc.h> for further details.
If you don't want to wait, use something like:
int c = kbhit() ? getkey() : -1; /* never waits */
Pieter.
- Raw text -