addwstr(3NCURSES)
β¨ addwstr β the ncurses wide-string glow-up β¨
okay so bestie, welcome to addwstr(3NCURSES), a genuine Library calls icon from the ncurses fam π she's the one who takes a whole wide-character string and just... drops it into your window, cursor sliding forward like she owns the place. and honestly? she does. π
πΈ NAME πΈ
addwstr, waddwstr, mvaddwstr, mvwaddwstr, addnwstr, waddnwstr, mvaddnwstr, mvwaddnwstr β add a wide-character string to a curses window and advance the cursor. that's the whole job. that's the whole vibe. β¨
π SYNOPSIS π
#include <curses.h>
int addwstr(const wchar_t * wstr);
int waddwstr(WINDOW * win, const wchar_t * wstr);
int mvaddwstr(int y, int x, const wchar_t * wstr);
int mvwaddwstr(WINDOW * win, int y, int x,
const wchar_t * wstr);
int addnwstr(const wchar_t * wstr, int n);
int waddnwstr(WINDOW * win, const wchar_t * wstr, int n);
int mvaddnwstr(int y, int x, const wchar_t * wstr, int n);
int mvwaddnwstr(WINDOW * win, int y, int x,
const wchar_t * wstr, int n);
π¦ DESCRIPTION π¦
so waddwstr writes the characters of the (wide-null-terminated) wide-character string wstr into the window win. the way it does this is giving build a cchar_t for each wchar_t in wstr, and then calling wadd_wch(3NCURSES) with the resulting cchar_t. iconic pipeline behavior, no cap. π₯
curses handles the spacing and non-spacing characters in wstr one at a time β she's methodical like that. π
waddnwstr is the same situation, except she writes at most n wide characters. and if n is -1? she writes the entire wide string, go off queen π
also, ncurses(3NCURSES) is the one who describes the variants of these functions β she's the group chat admin for all of this, iykyk.
π RETURN VALUE π
these functions return OK when it works and ERR when it doesn't. simple. binary. main character energy. β¨
in ncurses, these functions fail if:
- the curses screen has not been initialized π
wstris a null pointer π- (for the functions taking a
WINDOWpointer argument)winis a null pointer π« - an internal
wadd_wch(3NCURSES)call returnsERRπ
and the functions prefixed with βmvβ? they do cursor movement first, and they fail if the position (y, x) is outside the window boundaries. boundary check first, always. periodt. π
π NOTES π
all of these functions except waddnwstr may be implemented as macros. so like, don't do weird stuff with them. π§
π PORTABILITY π
X/Open Curses Issue 4 describes these functions. π
SVr4 describes a successful return value only as βan integer value other than ERRβ β which is so vague of them honestly, we love an unbothered king. π
π HISTORY π
X/Open Curses Issue 4 (1995) initially specified these functions. the System V Interface Definition Version 4 of that same year specified functions named waddwstr and waddnwstr (plus the usual variants, of course). and here's the tea: these were later additions to SVr4.x β they were not in the first SVr4 (1989). glow-up era, fr fr. π
β¨
π SEE ALSO π
addstr(3NCURSES) describes comparable functions of the ncurses library in its non-wide-character configuration β like, the regular-string sister. π«Ά
also go say hi to: ncurses(3NCURSES), add_wch(3NCURSES), add_wchstr(3NCURSES) π
and that's the page bestie!! πΈ this was ncurses 6.6, dated 2025-03-15, from the addwstr(3NCURSES) manual β go forth and write your wide strings, you absolute icon πβ¨π
π¦ 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 2019-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