curs_inch(3X)
π curs_inch β get a curses character from a window π
okay bestie, welcome to the curs_inch(3X) page, which lives in the Library calls section of the manual and is literally all about pulling one single character (plus its whole little vibe bundle of attributes) out of a window. no cap, it's a tiny family of four functions and they're all iconic. let's go π«Ά
β¨ NAME β¨
inch, winch, mvinch, mvwinch β get a curses character from a window π
πΈ 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 π
so winch returns the curses character β and when I say character I mean the whole package: its attributes and its color pair identifier too β sitting at the cursor position in the window win. it's giving "full character reveal". β¨
need to know how to actually dig those data out of a chtype? the subsection "Video Attributes" of attron(3X) has you covered, fr fr. and if you wanna know about all the variants of this function, ncurses(3X) is the one to read. π
π₯ RETURN VALUE π₯
OKwhen it slays (success) βERRwhen it does not (failure) π
in ncurses, they return ERR if win is NULL. like, no window, no character, sorry babe. π
and the functions prefixed with "mv"? they first do a cursor movement, and they fail if the position (y, x) is outside the window boundaries. boundaries are boundaries. π§
π NOTES π
inch,mvinch, andmvwinchmay be implemented as macros. sneaky but valid. π- these functions do not fail if the window contains cells of curses complex characters β meaning characters with codes wider than eight bits (or greater than 255 as an unsigned decimal integer). instead they just extract only the low-order eight bits of the character code from the cell. so yeah, the extra bits are justβ¦ not invited to the party. π
π PORTABILITY π
X/Open Curses Issue 4 describes these functions. it specifies no error conditions for them. that's it, that's the whole section. short and mysterious, main character energy. π
π¦ HISTORY π¦
okay storytime, this one's a journey:
- the original curses in 4BSD (1980) defined
winchas a macro accessing theWINDOWstructure member representing character cell data. at that time it was achar, holding only a 7-bit ASCII character code plus a "standout" attribute bit β the only one the library supported. humble beginnings bestie. π - SVr2 curses (1984) extended this approach: character code got widened to eight bits, and several attributes could now be combined with it by storing them all together in a
chtype, which was an alias ofunsigned short. because a macro was used, its value was not type-checked the way a function return value could have been. no vibe check on the type. π - Goodheart documented SVr3 (1987)
winchas returning anint. - SVr3.1's (1987)
chtypebecame an alias ofunsigned long, using 16 bits for the character code and widening the type in practical terms to 32 bits β because 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. and that's how we got the full glow-up. β¨
π SEE ALSO π
curs_in_wch(3X)β describes comparable functions of the ncurses library in its wide-character configuration (ncursesw).curses(3X)curs_instr(3X)
ncurses 6.6 πΈ 2025-02-15
and that's the whole page babes, mwah π this was ncurses 6.6 from 2025-02-15, stay hydrated, read your man pages, and go get that character out of your window π«Άβ¨π
π¦ where this page comes from
- alpine 3.24: ncurses-doc 6.6_p20260516-r0 Β· X11
- arch rolling: ncurses 6.6-2 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- Copyright 2018-2024,2025 Thomas E. Dickey
- Copyright 1998-2010,2017 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms