>I have an interface that must monitor multiple potential input through several
>fds opened for reading (only). One of the fds is a user keyboard, under the
>control of curses. For monitoring the inputs, have set up an fd_set data type
>with all the fds passed to select().
>The problem is with the user input. If a user hits the number '2' on the
>keypad, wgetch(), which is called after select() returns and its fd is set, is
>returning 033 (0x27, or ESC) instead of '2'.
033 != 0x27... I'll assume you mean 0x1b or 27.
Is your number lock on?
Quote:>The window of input has been set as 'keypad(window, FALSE)' to allow the '2'
>to be read. And based on a post read in the ng archives, I have called
>'nodelay(window, TRUE)' prior to calling select(), but the trouble remains.
Calling keypad() will only effect what value wgetch() returns for function
keys. If FALSE, it will return the (start of) the string of bytes sent by that
key, which could well be the esc you are seeing. If TRUE it will return a
single value such as KEY_DOWN (as defined in the curses header file).
If you press '2' on your keypad with number lock on, wgetch() will return '2',
whether you have called keypad() or not.
If you press '2' on you keypad with number lock off, wgetch() will return
KEY_DOWN if you have called keypad(w,TRUE), and will return the first byte of
the sequence that arrow down sends (very possibly esc) if you have called