control characters in C
Hi. I'm working on my ncurses application, written in C. I get user input through a loop which uses getchar(). I was able to recognize Ctrl-n by comparing the keypress to ASCII character 16, and this seems to work fine.
However, if I noticed that the ASCII character for Ctrl-j (10) is the same as the Line Feed. I tested this, and if I press enter on the keyboard I get the same ASCII value as when I press Ctrl-j. So, what do I do if I want Ctrl-j to mean something different in my program than pressing enter? The ncurses terminal mode is set to raw, with a 100 millisecond timeout, and keypad is on (I'm already using the up and down arrow-keys). |
Quote:
Unless you're willing to get raw keycodes (not raw characters, as you're getting now), ^J and <Enter> (or however that key is labeled on your keyboard) yield the same value exactly. |
All times are GMT -5. The time now is 05:19 PM. |