curs\_inch(3X) Library calls curs\_inch(3X)

# [NAME](#NAME)

**inch**, **winch**, **mvinch**, **mvwinch** - get a *curses* character from a window

# [SYNOPSIS](#SYNOPSIS)

```
#include <curses.h>
```

```
chtype inch(void);
chtype winch(WINDOW * win);
chtype mvinch(int y, int x);
chtype mvwinch(WINDOW * win, int y, int x);
```

# [DESCRIPTION](#DESCRIPTION)

**winch** returns the *curses* character, including its attributes and color pair identifier, at the cursor position in the window *win*. Subsection “Video Attributes” of [**attron**(3X)](/man/os/ncurses/attron.3X) explains how to extract these data from a *chtype*. [**ncurses**(3X)](/man/os/ncurses/ncurses.3X) describes the variants of this function.

# [RETURN VALUE](#RETURN_VALUE)

Functions prefixed with “mv” first perform cursor movement and fail, returning **ERR** if the position (*y*, *x*) is outside the window boundaries.

If *win* is *NULL*, *ncurses* returns **0**, which is not **OK**.

# [NOTES](#NOTES)

**inch**, **mvinch**, and **mvwinch** may be implemented as macros.

These functions do not fail if the window contains cells of *curses* complex characters; that is, if they contain characters with codes wider than eight bits (or greater than 255 as an unsigned decimal integer). The returned value depends upon the locale:

- If the locale encoding is UTF-8, *ncurses* extracts only the low-order eight bits of the character code from the cell.
- If the locale encoding is not UTF-8, *ncurses* converts the character from Unicode to the locale encoding, and extracts the low-order eight bits from the resulting character.

# [PORTABILITY](#PORTABILITY)

X/Open Curses Issue 4 describes these functions. It specifies no error conditions for them.

# [HISTORY](#HISTORY)

The original *curses* in 4BSD (1980) defined *winch* as a macro accessing the *WINDOW* structure member representing character cell data, at that time a *char*, containing only a 7-bit ASCII character code and a “standout“ attribute bit, the only one the library supported.

SVr2 *curses* (1984) extended this approach, widening the character code to eight bits and permitting several attributes to be combined with it by storing them together in a *chtype*, an alias of *unsigned short*. Because a macro was used, its value was not type-checked as a function return value could have been. Goodheart documented SVr3 (1987) *winch* as returning an *int*. SVr3.1's (1987) *chtype* became an alias of *unsigned long*, using 16 bits for the character code and widening the type in practical terms to 32 bits, as 64-bit Unix systems were not yet in wide use, and fixed-width integral types would not be standard until ISO C99. SVr3.2 (1988) added a 6-bit color pair identifier alongside the attributes.

# [SEE ALSO](#SEE_ALSO)

[**curs\_in\_wch**(3X)](/man/os/ncurses/curs_in_wch.3X) describes comparable functions of the *ncurses* library in its wide-character configuration (*ncursesw*).

[**curses**(3X)](/man/os/ncurses/curses.3X), [**curs\_instr**(3X)](/man/os/ncurses/curs_instr.3X)

2026-07-04 ncurses 6.6

---

Document: inch(3x) from ncurses 6.6.20261031-r0 (Chainguard OS)
Source: https://github.com/ThomasDickey/ncurses-snapshots
