in_wchstr(3NCURSES)
π in_wchstr β get a curses complex character string from a window π
okay bestie, welcome to in_wchstr(3NCURSES) β yes that's the manual name, it lives in section 3NCURSES and it's literally all about scooping a whole complex character string out of a curses window. no cap. let's get into it π«Ά
β¨ NAME β¨
in_wchstr, in_wchnstr, win_wchstr, win_wchnstr, mvin_wchstr, mvin_wchnstr, mvwin_wchstr, mvwin_wchnstr β get a curses complex character string from a window π
πΈ SYNOPSIS πΈ
#include <curses.h>
int in_wchstr(cchar_t * wchstr);
int win_wchstr(WINDOW * win, cchar_t * wchstr);
int mvin_wchstr(int y, int x, cchar_t * wchstr);
int mvwin_wchstr(WINDOW * win, int y, int x, cchar_t * wchstr);
int in_wchnstr(cchar_t * wchstr, int n);
int win_wchnstr(WINDOW * win, cchar_t * wchstr, int n);
int mvin_wchnstr(int y, int x, cchar_t * wchstr, int n);
int mvwin_wchnstr(WINDOW * win, int y, int x, cchar_t * wchstr, int n)
(yes the last one is missing its semicolon, that's how it is in the source, we don't fix, we don't judge, we just vibe π )
π¦ DESCRIPTION π¦
so win_wchstr pulls a curses complex character string out of a curses window called win, starting right at the cursor and going until the end of the line, then stashes it in wchstr and terminates it with a wide null curses character. that's the whole move, and it ate β¨
win_wchnstr does the exact same thing, but it copies at most n curses complex characters from win. and here's the tea: if n is negative that means no limit at all, so win_wchnstr just starts acting like win_wchstr. iconic behaviour honestly.
also, if you wanna know about all the variants of these functions, ncurses(3NCURSES) has the whole lore. iykyk π
π RETURN VALUE π
these functions return OK when everything slays and ERR when it does not. simple as that.
in ncurses, these functions fail if:
- the curses screen has not been initialized π
- (for the functions that take a
WINDOWpointer argument) win is a null pointer - wchstr is a null pointer
and the ones prefixed with βmvβ first do a little cursor movement moment, and they fail if the position (y, x) is outside the window boundaries. boundaries are boundaries bestie π§
π NOTES π
- all of these functions except
win_wchnstrmay be implemented as macros. surprises abound π - reading a line that overflows the array pointed to by wchstr and its variants causes undefined results. like, undefined-undefined. not a vibe. instead, use the
n-infixed functions with a positive n argument that is no larger than the size of the buffer backing wchstr. protect your buffer, protect your peace π«Ά
fr fr do not skip the buffer size thing, undefined results is not the main character energy you want
π PORTABILITY π
X/Open Curses Issue 4 describes these functions. it specifies no error conditions for them. so like, do with 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
winwchstr(plus the usual variants). note: no underscore, we love a subtle rebrand π - that one was a later addition to SVr4.x and did not appear in the first SVr4 (1989) π°οΈ
- and it differed from X/Open's later
win_wchstrbecause it took an argument of type pointer-to-chtypeinstead of pointer-to-cchar_t. tiny type change, huge consequences π
π SEE ALSO π
inchstr(3NCURSES)β describes comparable functions of the ncurses library in its non-wide-character configurationncurses(3NCURSES)inwstr(3NCURSES)in_wch(3NCURSES)
and that's the whole page bestie!! this was ncurses 6.6, dated 2025-10-20, and it's the in_wchstr(3NCURSES) page so you know exactly where to find it again π go forth and read your complex character strings responsibly, mwah ππ
π¦ 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-2012,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