[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

keyname, key_name Subroutine

Purpose

Gets the name of keys.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>

char *keyname(int c);

char *key_name(wchar_t c);

Description

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.

Parameter

c

Return Values

Upon successful completion, the keyname subroutine returns a pointer to a string as described above, Otherwise, it returns a null pointer.

Examples

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.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The meta and wgetch subroutines.

List of Curses Subroutines in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Contents | Glossary | Home | Search ]