while(ch != 'q') { printf("looping\n"); sleep(1); if(kbhit()) { ch = readch(); printf("you hit %c\n",ch); } }
This code gives me a blocking getch () function. I am trying to use this code to capture down arrows.
Added: Attempting to capture key up arrow codes gives me 3 characters 27, 91 and 65. Using if / else, I try to match the pattern, but I get only 2 characters. The next one is captured by pressing the next key.
I want to capture complete words using getchar (), always looking for specific keys all the time (esc, del, etc.).
c inputstream console getch
Alex Xander 03 Oct '09 at 13:25 2009-10-03 13:25
source share