I'm using the newest version of Dev 4. I want to use something that waits for the user to hit a key, and then moves on without displaying the key. I thought that:
char i;
i = getch();
would do this, but it displays the letter and waits until I press enter. How do I get around this?
- Thanx in advance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using the newest version of Dev 4. I want to use something that waits for the user to hit a key, and then moves on without displaying the key. I thought that:
char i;
i = getch();
would do this, but it displays the letter and waits until I press enter. How do I get around this?
- Thanx in advance
just put
getch();
Curtis
P.S. getche(); will display what the user hit
Proper way to do this (use inp.Event.KeyEvent.wVirtualKeyCode or
inp.Event.KeyEvent.uChar.AsciiChar):
#include <windows.h>
INPUT_RECORD inp;
unsigned long w;
ReadConsoleInput (GetStdHandle (STD_INPUT_HANDLE), &inp, 1, (LPDWORD) &w);