#include <curses.h>
char *keyname(int c);
char *key_name(wchar_t c);
The keyname and key_name subroutines generate a character string whose value describes the key c. The c argument of keyname can be an 8-bit character or a key code. The c argument of key_name must be a wide character.
The string has a format according to the first applicable row in the following table:
Input | Format of Returned String |
Visible character | The same character |
Control character | ^X |
Meta-character (keyname only) | M-X |
Key value defined in <curses.h> (keyname only) | KEY_name |
None of the above | UNKNOWN KEY |
The meta-character notation shown above is used only, if meta-characters are enabled.
Upon successful completion, the keyname subroutine returns a pointer to a string as described above, Otherwise, it returns a null pointer.
int key; char *name; keypad(stdscr, TRUE); addstr("Hit a key"); key=getch(); name=keyname(key);
Note: If the Page Up key is pressed, keyname will return KEY_PPAGE.
This subroutine is part of Base Operating System (BOS) Runtime.
The meta and wgetch subroutines.
List of Curses Subroutines in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.