I want to get on_key_press_event
without pressing Enter.
And of course I need the character code. Is there solution?
I recommend having a read through here. I think
getchar()
might be what you're after.
EDIT: In fact possibly
#include <conio.h>
_getch()
would work better for you as it does not require the end of line character (enter button to be pressed). For windows refer to this and for unix systems this seems to be included in the curses library.
Hope this helps!
There's no cross-platform way to do unbuffered input from stdin. You can use curses if you're on a Unix-based distribution. On Windows you can use getch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With