1curs_get_wch(3X)                                              curs_get_wch(3X)
2
3
4

NAME

6       get_wch, wget_wch, mvget_wch, mvwget_wch, unget_wch - get (or push
7       back) a wide character from curses terminal keyboard
8

SYNOPSIS

10       #include <curses.h>
11
12       int get_wch(wint_t *wch);
13       int wget_wch(WINDOW *win, wint_t *wch);
14       int mvget_wch(int y, int x, wint_t *wch);
15       int mvwget_wch(WINDOW *win, int y, int x, wint_t *wch);
16
17       int unget_wch(const wchar_t wch);
18

DESCRIPTION

20       The get_wch, wget_wch, mvget_wch, and mvwget_wch functions read a char‐
21       acter  from  the terminal associated with the current or specified win‐
22       dow.  In no-delay mode, if no input is waiting, the value  ERR  is  re‐
23       turned.   In delay mode, the program waits until the system passes text
24       through to the program.  Depending on the setting of  cbreak,  this  is
25       after one character (cbreak mode), or after the first newline (nocbreak
26       mode).  In half-delay mode, the program waits until the  user  types  a
27       character or the specified timeout interval has elapsed.
28
29       Unless  noecho has been set, these routines echo the character into the
30       designated window.
31
32       If the window is not a pad and has been moved  or  modified  since  the
33       last call to wrefresh, wrefresh will be called before another character
34       is read.
35
36       If keypad is enabled, these functions respond  to  the  pressing  of  a
37       function key by setting the object pointed to by wch to the keycode as‐
38       signed to the function key, and returning KEY_CODE_YES.  If a character
39       (such  as  escape) that could be the beginning of a function key is re‐
40       ceived, curses sets a timer.  If the remainder of the sequence does ar‐
41       rive  within  the designated time, curses passes through the character;
42       otherwise, curses returns the function key  value.   For  this  reason,
43       many  terminals  experience a delay between the time a user presses the
44       escape key and the time the escape is returned to the program.
45
46       The keycodes returned by these functions are the same as those returned
47       by wgetch:
48
49       •   The  predefined  function  keys  are listed in <curses.h> as macros
50           with values outside the range of 8-bit characters.  Their names be‐
51           gin with KEY_.
52
53       •   Other  (user-defined)  function keys which may be defined using de‐
54           fine_key(3X) have no names, but also are expected  to  have  values
55           outside the range of 8-bit characters.
56
57       The unget_wch function pushes the wide character wch back onto the head
58       of the input queue, so the wide character is returned by the next  call
59       to  get_wch.  The pushback of one character is guaranteed.  If the pro‐
60       gram calls unget_wch too many times  without  an  intervening  call  to
61       get_wch, the operation may fail.
62

NOTES

64       The  header  file  <curses.h>  automatically  includes  the header file
65       <stdio.h>.
66
67       Applications should not define the escape key by itself  as  a  single-
68       character function.
69
70       When  using  get_wch,  wget_wch, mvget_wch, or mvwget_wch, applications
71       should not use nocbreak mode and echo mode at the same time.  Depending
72       on  the  state of the tty driver when each character is typed, the pro‐
73       gram may produce undesirable results.
74
75       All functions except wget_wch and unget_wch may be macros.
76

RETURN VALUE

78       When get_wch, wget_wch, mvget_wch, and mvwget_wch functions successful‐
79       ly  report  the  pressing  of a function key, they return KEY_CODE_YES.
80       When they successfully report a wide character, they return OK.  Other‐
81       wise, they return ERR.
82
83       Upon successful completion, unget_wch returns OK.  Otherwise, the func‐
84       tion returns ERR.
85
86       Functions with a “mv” prefix first  perform  a  cursor  movement  using
87       wmove, and return an error if the position is outside the window, or if
88       the window pointer is null.
89

SEE ALSO

91       curses(3X),    curs_getch(3X),    curs_ins_wch(3X),    curs_inopts(3X),
92       curs_move(3X), curs_refresh(3X)
93
94
95
96                                                              curs_get_wch(3X)
Impressum