a question about using curses lib

Xinhua Wu xwu at pollux.usc.edu
Sat Feb 20 06:56:06 AEST 1988


I'm writing a program using curses lib.  I want to use function keys (eg,
use arrow keys to choose from a menu).  The program should work for different
terminal types (vt100, xterm, ibmaed, h19, etc).

My general question is: how can I make the program recognize a function key
immediately after the user hits it?

I'm now using wgetch(win) to read the input (wgetstr(win, str) needs a newline
or EOF).  The problem is that in this case the program needs to know in advance
the code for a function key and how long the code is.  Since the code and the
length vary for different terminal types (eg, the code for uparrow is \033A
for ibmaed, \033[A for xterm and vt100 under X), the program may not work
for new terminal types.

Thanks in advance for any help.


Xinhua Wu
xwu at cse.usc.edu



More information about the Comp.unix.questions mailing list