1curs_getwch(3CURSES) Curses Library Functions curs_getwch(3CURSES)
2
3
4
6 curs_getwch, getwch, wgetwch, mvgetwch, mvwgetwch, ungetwch - get (or
7 push back) wchar_t characters from curses terminal keyboard
8
10 cc [ flag ... ] file ... -lcurses [ library .. ]
11 #include <curses.h>
12
13 int getwch(void);
14
15
16 int wgetwch(WINDOW *win);
17
18
19 int mvgetwch(int y, int x);
20
21
22 int mvwgetwch(WINDOW *win, int y, int x);
23
24
25 int ungetwch(int wch);
26
27
29 The getwch(), wgetwch(), mvgetwch(), and mvwgetwch() routines read an
30 EUC character from the terminal associated with the window, transform
31 it into a wchar_t character, and return a wchar_t character. In no-
32 delay mode, if no input is waiting, the value ERR is returned. In delay
33 mode, the program waits until the system passes text through to the
34 program. Depending on the setting of cbreak, this is after one charac‐
35 ter ( cbreak mode ), or after the first newline (nocbreak mode ). In
36 half-delay mode, the program waits until a character is typed or the
37 specified timeout has been reached. Unless noecho has been set, the
38 character will also be echoed into the designated window.
39
40
41 If the window is not a pad, and it has been moved or modified since the
42 last call to wrefresh(3CURSES), wrefresh will be called before another
43 character is read.
44
45
46 If keypad is TRUE, and a function key is pressed, the token for that
47 function key is returned instead of the raw characters. Possible func‐
48 tion keys are defined in <curses.h> with integers beginning with 0401,
49 whose names begin with KEY_. If a character that could be the beginning
50 of a function key (such as escape) is received, curses(3CURSES) sets a
51 timer. If the remainder of the sequence does not come in within the
52 designated time, the character is passed through; otherwise, the func‐
53 tion key value is returned. For this reason, many terminals experience
54 a delay between the time a user presses the escape key and the escape
55 is returned to the program.
56
57
58 The ungetwch() routine places wch back onto the input queue to be
59 returned by the next call to wgetwch().
60
61 Function Keys
62 The following function keys, defined in <curses.h>, might be returned
63 by getwch() if keypad has been enabled. Note that not all of these
64 may be supported on a particular terminal if the terminal does not
65 transmit a unique code when the key is pressed or if the definition for
66 the key is not present in the terminfo(4) database.
67
68
69
70
71 ┌───────────────────────────────────────────────────────────────┐
72 │ Name Key name │
73 ├───────────────────────────────────────────────────────────────┤
74 │KEY_BREAK Break key │
75 │KEY_DOWN The four arrow keys ... │
76 │KEY_UP │
77 │KEY_LEFT │
78 │KEY_RIGHT │
79 │KEY_HOME Home key (upward+left arrow) │
80 │KEY_BACKSPACE Backspace │
81 │KEY_F0 Function keys; space for 64 keys │
82 │ is reserved. │
83 │KEY_F(n) For 0 ≤ n ≤ 63 │
84 │KEY_DL Delete line │
85 │KEY_IL Insert line │
86 │KEY_DC Delete character │
87 │KEY_IC Insert char or enter insert mode │
88 │KEY_EIC Exit insert char mode │
89 │KEY_CLEAR Clear screen │
90 │KEY_EOS Clear to end of screen │
91 │KEY_EOL Clear to end of line │
92 │KEY_SF Scroll 1 line forward │
93 │ KEY_SR Scroll 1 line backward (reverse) │
94 │KEY_NPAGE Next page │
95 │KEY_PPAGE Previous page │
96 │KEY_STAB Set tab │
97 │KEY_CTAB Clear tab │
98 │KEY_CATAB Clear all tabs │
99 │KEY_ENTER Enter or send │
100 │KEY_SRESET Soft (partial) reset │
101 │KEY_RESET Reset or hard reset │
102 │KEY_PRINT Print or copy │
103 │KEY_LL Home down or bottom (lower │
104 │ left). Keypad is arranged like │
105 │ this: A1 up A3 left │
106 │ B2 right C1 down C3 │
107 │KEY_A1 Upper left of keypad │
108 │KEY_A3 Upper right of keypad │
109 │KEY_B2 Center of keypad │
110 │KEY_C1 Lower left of keypad │
111 │KEY_C3 Lower right of keypad │
112 │KEY_BTAB Back tab key │
113 │KEY_BEG Beg(inning) key │
114 │KEY_CANCEL Cancel key │
115 │KEY_CLOSE Close key │
116 │KEY_COMMAND Cmd (command) key │
117 │KEY_COPY Copy key │
118 │KEY_CREATE Create key │
119 │KEY_END End key │
120 │KEY_EXIT Exit key │
121 │KEY_FIND Find key │
122 │KEY_HELP Help key │
123 │KEY_MARK Mark key │
124 │KEY_MESSAGE Message key │
125 │KEY_MOVE Move key │
126 │KEY_NEXT Next object key │
127 │KEY_OPEN Open key │
128 │KEY_OPTIONS Options key │
129 │KEY_PREVIOUS Previous object key │
130 │KEY_REDO Redo key │
131 │KEY_REFERENCE Reference key │
132 │KEY_REFRESH Refresh key │
133 │KEY_REPLACE Replace key │
134 │KEY_RESTART Restart key │
135 │KEY_RESUME Resume key │
136 │KEY_SAVE Save key │
137 │KEY_SBEG Shifted beginning key │
138 │KEY_SCANCEL Shifted cancel key │
139 │KEY_SCOMMAND Shifted command key │
140 │KEY_SCOPY Shifted copy key │
141 │KEY_SCREATE Shifted create key │
142 │KEY_SDC Shifted delete char key │
143 │KEY_SDL Shifted delete line key │
144 │KEY_SELECT Select key │
145 │KEY_SEND Shifted end key │
146 │KEY_SEOL Shifted clear line key │
147 │KEY_SEXIT Shifted exit key │
148 │KEY_SFIND Shifted find key │
149 │KEY_SHELP Shifted help key │
150 │KEY_SHOME Shifted home key │
151 │KEY_SIC Shifted input key │
152 │KEY_SLEFT Shifted left arrow key │
153 │KEY_SMESSAGE Shifted message key │
154 │KEY_SMOVE Shifted move key │
155 │KEY_SNEXT Shifted next key │
156 │KEY_SOPTIONS Shifted options key │
157 │KEY_SPREVIOUS Shifted prev key │
158 │KEY_SPRINT Shifted print key │
159 │KEY_SREDO Shifted redo key │
160 │KEY_SREPLACE Shifted replace key │
161 │KEY_SRIGHT Shifted right arrow │
162 │KEY_SRSUME Shifted resume key │
163 │KEY_SSAVE Shifted save key │
164 │KEY_SSUSPEND Shifted suspend key │
165 │KEY_SUNDO Shifted undo key │
166 │KEY_SUSPEND Suspend key │
167 │KEY_UNDO Undo key │
168 └───────────────────────────────────────────────────────────────┘
169
171 All routines return the integer ERR upon failure and an integer value
172 other than ERR upon successful completion.
173
175 See attributes(5) for descriptions of the following attributes:
176
177
178
179
180 ┌─────────────────────────────┬─────────────────────────────┐
181 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
182 ├─────────────────────────────┼─────────────────────────────┤
183 │MT-Level │Unsafe │
184 └─────────────────────────────┴─────────────────────────────┘
185
187 curses(3CURSES), curs_inopts(3CURSES), curs_move(3CURSES), wre‐
188 fresh(3CURSES), terminfo(4), attributes(5)
189
191 The header file <curses.h> automatically includes the header files
192 <stdio.h>, <unctrl.h> and <widec.h>.
193
194
195 Use of the escape key by a programmer for a single character function
196 is discouraged.
197
198
199 When using getwch(), wgetwch(), mvgetwch(), or mvwgetwch(), nocbreak
200 mode and echo mode should not be used at the same time. Depending on
201 the state of the tty driver when each character is typed, the program
202 may produce undesirable results.
203
204
205 Note that getwch(), mvgetwch(), and mvwgetwch() may be macros.
206
207
208
209SunOS 5.11 31 Dec 1996 curs_getwch(3CURSES)