Do a function until a key is pressed.
by doom_23 from LinuxQuestions.org on (#5DW3B)
Hello. This is my first post here :)
I develop a little tool in C++ and I need to run some function while a key is pressed. I tried to use the getch() function and it works but if I am pressing a key, function calls 1 time, then I have wait until the "keyboard delay" will pass (I have 500ms delay in my xfce settings), and only then function will looped.
But how can I avoid this 500ms delay and immediately run a function?


I develop a little tool in C++ and I need to run some function while a key is pressed. I tried to use the getch() function and it works but if I am pressing a key, function calls 1 time, then I have wait until the "keyboard delay" will pass (I have 500ms delay in my xfce settings), and only then function will looped.
But how can I avoid this 500ms delay and immediately run a function?