K
Koen
Hi!
What is the best way to check whether a key is pressed without blocking
in C++?
I know I can use cin.get(c) to get a character from standard input, but
this blocks.
And I know _kbhit() exists in MSVC++, but that's in <conio.h> and
probably not standard, is it?
I need a way to say:
1. do something
2. check if a key was pressed
3. if no key was pressed, go to 1.
4. if a key WAS pressed, continue with 5.
5. the rest of the program
Thanks in advance for any hints!
Koen
What is the best way to check whether a key is pressed without blocking
in C++?
I know I can use cin.get(c) to get a character from standard input, but
this blocks.
And I know _kbhit() exists in MSVC++, but that's in <conio.h> and
probably not standard, is it?
I need a way to say:
1. do something
2. check if a key was pressed
3. if no key was pressed, go to 1.
4. if a key WAS pressed, continue with 5.
5. the rest of the program
Thanks in advance for any hints!
Koen