View Full Version : KeyPress in C

02-16-2005, 01:05 AM
how do I get it so when the user presses a character, it performs a set of operations without having to press enter...

so scanf("%c", &choice);

then when the certain character is pressed a set of instructions will happen... without having to press enter during the scanf?

thanks alot,

02-16-2005, 01:25 AM
I dont believe there is any standard way to do that. It depends on what platform and what functions your compiler has implemented. For example, on Windows and with MSVC compiler, _getch() and _getche() defined in <conio.h> do what you want.

If your compiler doesn't implement a function like that, you can always write your own, which isn't an easy task really.

02-16-2005, 01:41 AM
This works great! Thanks alot...