GET_WCH(3XCURSES) X/Open Curses Library Functions GET_WCH(3XCURSES)

get_wch, wget_wch, mvget_wch, mvwget_wch - get a wide character from terminal

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);

The get_wch() and wget_wch() functions get a wide character from the terminal associated with the window stdscr or window win, respectively. The mvget_wch() and mvwget_wch() functions move the cursor to the position specified in stdscr or win, respectively, then get a character.

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).

Is a pointer to a wide integer where the returned wide character or KEY_ value can be stored.


Is a pointer to the window associated with the terminal from which the character is to be read.


Is the y (row) coordinate for the position of the character to be read.


Is the x (column) coordinate for the position of the character to be read.

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.


See attributes(5) for descriptions of the following attributes:

Interface Stability Standard
MT-Level Unsafe

cbreak(3XCURSES), echo(3XCURSES), halfdelay(3XCURSES), keypad(3XCURSES), libcurses(3XCURSES), nodelay(3XCURSES), notimeout(3XCURSES), raw(3XCURSES), timeout(3XCURSES), attributes(5), standards(5)

June 5, 2002 OmniOS