C++ Question

pac1085

Diamond Member
Jun 27, 2000
3,456
0
76
Anyone know of a function similar to kbhit() that records the characters entered instead of just true or false?
 

BFG10K

Lifer
Aug 14, 2000
22,709
3,007
126
You can use getch() when the kbhit() function returns true. For example:


char ch;
if (kbhit()) ch = getch();


I forget whether getch returns the keypress or whether you are supposed to pass in ch like this: getch (ch). Either way ch will store the keypress.