I am developing a C application using ncurses library in linux. my program cant distinguish between Alt and Esc keypresses. both return 27! can you help me how I can distinguish between the two? thank you
Asked
Active
Viewed 309 times
2 Answers
2
You need to incorporate a short delay after the ^[
in order to see if there are further characters incoming. If not, then Esc has been pressed.

Ignacio Vazquez-Abrams
- 776,304
- 153
- 1,341
- 1,358
-
I don't know how to do that! do u mean using sleep/usleep ? could you kindly provide an example? – rahman Jun 29 '11 at 07:53
1
-
I had already seen that. But didn't know what ERR means. could you please provide an example for me? thanks (i think even without using ncurses u can provide an example. am i right?) thanks again – rahman Jun 29 '11 at 07:56
-
2ncurses timeout does the job very well. timeout(1); ch=getch(); if(ch=='d') {...} thank you all – rahman Aug 03 '11 at 10:36