How to get a function key in BSD curses

Gregory Gulik greg at gagme.chi.il.us
Fri Jun 29 05:14:42 AEST 1990


In article <502 at seer.UUCP> bll at seer.UUCP (Brad Lanam) writes:
>
>    Is there some easy way to get a function key using Berkeley curses?
>I don't have access to the documentation, and the O'Reilly "curses" book
>doesn't mention anything about the special keys.

Use the keypad(win,bf) function.

For example, I always do:	keypad(stdscr,1);
to turn on keypad mode.

Then, you can use the getch() function to read the keys in.  Look
at your system's curses.h file for the key definitions.  Mine has
a lot of comments explaining what they are.

Oh, you may want to call cbreak() to get into one-key-at-a-time
mode.

-greg

-- 
Gregory A. Gulik					Call Gagme, a public
	greg at gagme.chi.il.us  ||  ...!gagme!greg	access UNIX system at
	||  gulik at depaul.edu				(708) 318-7133



More information about the Comp.unix.questions mailing list