Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   getch.3x    ( 3 )

получить (или вернуть) символы с клавиатуры терминала curses (get (or push back) characters from curses terminal keyboard)

  Name  |  Synopsis  |  Description  |  Return value  |    Note    |  Portability  |  See also  |

Примечание (Note)

Use of the escape key by a programmer for a single character function is discouraged, as it will cause a delay of up to one second while the keypad code looks for a following function-key sequence.

Some keys may be the same as commonly used control keys, e.g., KEY_ENTER versus control/M, KEY_BACKSPACE versus control/H. Some curses implementations may differ according to whether they treat these control keys specially (and ignore the terminfo), or use the terminfo definitions. Ncurses uses the terminfo definition. If it says that KEY_ENTER is control/M, getch will return KEY_ENTER when you press control/M.

Generally, KEY_ENTER denotes the character(s) sent by the Enter key on the numeric keypad:

• the terminal description lists the most useful keys,

• the Enter key on the regular keyboard is already handled by the standard ASCII characters for carriage-return and line- feed,

• depending on whether nl or nonl was called, pressing 'Enter' on the regular keyboard may return either a carriage-return or line-feed, and finally

• 'Enter or send' is the standard description for this key.

When using getch, wgetch, mvgetch, or mvwgetch, nocbreak mode (nocbreak) and echo mode (echo) should not be used at the same time. Depending on the state of the tty driver when each character is typed, the program may produce undesirable results.

Note that getch, mvgetch, and mvwgetch may be macros.

Historically, the set of keypad macros was largely defined by the extremely function-key-rich keyboard of the AT&T 7300, aka 3B1, aka Safari 4. Modern personal computers usually have only a small subset of these. IBM PC-style consoles typically support little more than KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_NPAGE, KEY_PPAGE, and function keys 1 through 12. The Ins key is usually mapped to KEY_IC.