get_wch(3XCURSES) X/Open Curses Library Functions get_wch(3XCURSES)NAME
get_wch, wget_wch, mvget_wch, mvwget_wch - get a wide character from
terminal
SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib \
-R /usr/xpg4/lib -lcurses [ library... ]
c89 [ flag... ] file... -lcurses [ library... ]
#include <curses.h>
int get_wch(wint_t *ch);
int wget_wch(WINDOW *win, wint_t *ch);
int mvget_wch(int y, int x, wint_t *ch);
int mvwget_wch(WINDOW *win, int y, int x, wint_t *ch);
DESCRIPTION
The get_wch() and wget_wch() functions get a wide character from the
terminal associated with the window stdscr or window win, respec‐
tively. The mvget_wch() and mvwget_wch() functions move the cursor to
the position specified in stdscr or win, respectively, then get a char‐
acter.
If the window is not a pad and has been changed since the last call to
refresh(3XCURSES), get_wch() calls refresh() to update the window
before the next character is read.
The setting of certain functions affects the behavior of the get_wch()
set of functions. For example, if cbreak(3XCURSES) is set, characters
typed by the user are immediately processed. If halfdelay(3XCURSES) is
set, get_wch() waits until a character is typed or returns ERR if no
character is typed within the specified timeout period. This timeout
can also be specified for individual windows with the delay parameter
of timeout (3XCURSES) A negative value waits for input; a value of 0
returns ERR if no input is ready; a positive value blocks until input
arrives or the time specified expires (in which case ERR is returned).
If nodelay(3XCURSES) is set, ERR is returned if no input is waiting;
if not set, get_wch() waits until input arrives. Each character will
be echoed to the window unless noecho(3XCURSES) has been set.
If keypad handling is enabled ( keypad(3XCURSES) is TRUE), the token
for the function key (a KEY_ value) is stored in the object pointed to
by ch and KEY_CODE_YES is returned. If a character is received that
could be the beginning of a function key (for example, <ESC>), an
inter-byte timer is set. If the remainder of the sequence is not
received before the time expires, the character is passed through;
otherwise, the value of the function key is returned. If notimeout()
is set, the inter-byte timer is not used.
The <ESC> key is typically a prefix key used with function keys and
should not be used as a single character.
See the getch(3XCURSES) manual page for a list of tokens for function
keys that are returned by the get_wch() set of functions if keypad
handling is enabled (Some terminals may not support all tokens).
PARAMETERS
ch Is a pointer to a wide integer where the returned wide charac‐
ter or KEY_ value can be stored.
win Is a pointer to the window associated with the terminal from
which the character is to be read.
y Is the y (row) coordinate for the position of the character to
be read.
x Is the x (column) coordinate for the position of the character
to be read.
RETURN VALUES
When these functions successfully report the pressing of a function
key, they return KEY_CODE_YES. When they successfully report a wide
character, they return OK. Otherwise, they return ERR.
ERRORS
None.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
┌─────────────────────────────┬─────────────────────────────┐
│ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
├─────────────────────────────┼─────────────────────────────┤
│Interface Stability │Standard │
├─────────────────────────────┼─────────────────────────────┤
│MT-Level │Unsafe │
└─────────────────────────────┴─────────────────────────────┘
SEE ALSOcbreak(3XCURSES), echo(3XCURSES), halfdelay(3XCURSES), key‐
pad(3XCURSES), libcurses(3XCURSES), nodelay(3XCURSES), notime‐
out(3XCURSES), raw(3XCURSES), timeout(3XCURSES), attributes(5), stan‐
dards(5)SunOS 5.10 5 Jun 2002 get_wch(3XCURSES)