in_wch(3NCURSES)
π in_wch β get a curses complex character from a window π
okay bestie, so this is a library call page from the 3NCURSES corner of the world. Sit down, grab a boba, we're learning how to yoink a complex character out of a window. β¨
β¨ NAME β¨
in_wch, win_wch, mvin_wch, mvwin_wch β get a curses complex character from a window π¦
πΈ SYNOPSIS πΈ
#include <curses.h>
int in_wch(cchar_t * wch);
int win_wch(WINDOW * win, cchar_t * wch);
int mvin_wch(int y, int x, cchar_t * wch);
int mvwin_wch(WINDOW * win, int y, int x, cchar_t * wch);
π DESCRIPTION π
So here's the tea: win_wch copies the curses complex character that's sitting at the cursor position in win right into wch. Like, it reaches in and grabs it. π«³β¨
Then, to actually pull apart what you got β its character code, its attributes, and its color pair identifier β you use getcchar(3NCURSES). That's the unlock. π
And if you're wondering about all the different flavors of this function, ncurses(3NCURSES) describes the variants. iykyk. π
π₯ RETURN VALUE π₯
OKon success πERRon failure π
In ncurses specifically, they return ERR if win is NULL. Yeah. No window, no vibes.
And for the ones prefixed with mv β those do a cursor movement first, and they fail if the position (y, x) is outside the window boundaries. Stay in bounds or get an ERR, no in-between. π§
π NOTES π
in_wch,mvin_wch, andmvwin_wchmay be implemented as macros. Sneaky little things. π- Unlike
winch(3NCURSES),win_wchand its variants store the value of the retrieved character in an additionalwchparameter instead of in the return value. That's the whole plot twist of this function fr fr. π
π§ PORTABILITY π§
X/Open Curses Issue 4 describes these functions. It specifies no error conditions for them. So likeβ¦ make of that what you will. π€·βοΈ
π HISTORY π
X/Open Curses Issue 4 (1995) initially specified these functions. The System V Interface Definition Version 4 of the same year specified a function named winwch (and the usual variants). That one was a later addition to SVr4.x β it did not appear in the first SVr4 (1989), so don't go looking for it there. π΅οΈβοΈ
And here's the difference, bestie: it differed from X/Open's later win_wch in that it returned a value of type chtype instead of cchar_t. So close, yet so different. π
π SEE ALSO π
inch(3NCURSES)β describes comparable functions of the ncurses library in its non-wide-character configuration. The skinny version. π¦ncurses(3NCURSES)inwstr(3NCURSES)
and that's the whole page, bestie, you ate that πβ¨ go forth and grab your complex characters, main character energy only π
ncurses 6.6 Β· 2025-02-01 Β· in_wch(3NCURSES) β periodt. π
π
π¦ where this page comes from
- ubuntu resolute: ncurses-doc 6.6+20251231-1 Β· MIT/X11
- ubuntu stonking: ncurses-doc 6.6+20260608-2 Β· MIT/X11
- Copyright 2018-2024,2025 Thomas E. Dickey
- Copyright 2002-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