curs_addstr(3X)
β¨ curs_addstr(3X) β¨
okay bestie so this is a page from the Library calls section of the manual, and it's literally just "put a string in a window and let the cursor vibe forward" π
πΈ NAME πΈ
addstr, waddstr, mvaddstr, mvwaddstr, addnstr, waddnstr, mvaddnstr, mvwaddnstr β add a string to a curses window and advance the cursor. yes queen, that's the whole job π
π¦ SYNOPSIS π¦
#include <curses.h>
int addstr(const char * str);
int waddstr(WINDOW * win, const char * str);
int mvaddstr(int y, int x, const char * str);
int mvwaddstr(WINDOW * win, int y, int x, const char * str);
int addnstr(const char * str, int n);
int waddnstr(WINDOW * win, const char * str, int n);
int mvaddnstr(int y, int x, const char * str, int n);
int mvwaddnstr(WINDOW * win, int y, int x, const char * str, int n);
π DESCRIPTION π
so waddstr writes the characters of the (null-terminated) string str to the window win, as if by calling waddch(3X) for each char in str. it's giving "one character at a time but make it a whole sentence" β¨
waddnstr is similar, but writes at most n characters. and here's the lil trick: if n is -1, waddnstr writes the entire string. no cap, -1 means "bestie, just do the whole thing" π
ncurses(3X) describes the variants of these functions.
π RETURN VALUE π
These functions return OK on success and ERR on failure. simple as that π«Ά
In ncurses, these functions fail if
- the
cursesscreen has not been initialized, stris a null pointer,- (for functions taking a
WINDOWpointer argument)winis a null pointer, or - an internal
waddch(3X)call returnsERR.
Functions prefixed with βmvβ first perform cursor movement and fail if the position (y, x) is outside the window boundaries. so like, if you try to move somewhere that doesn't exist, she's not going, periodt π
π NOTES π
All of these functions except waddnstr may be implemented as macros. iykyk β that means no taking their address, bestie π
π PORTABILITY π
X/Open Curses Issue 4 describes these functions. It specifies no error conditions for them. so like, zero error lore in the spec, iconic of them honestly π
SVr4 describes a successful return value only as βan integer value other than ERRβ.
β HISTORY β
4BSD (1980) introduced waddstr along with its variants, the latter defined as macros. vintage π
SVr3.1 (1987) added waddnstr (and its variants) redefining waddstr as a macro wrapping it. glow-up era β¨
π SEE ALSO π
curs_addwstr(3X) describes comparable functions of the ncurses library in its wide-character configuration (ncursesw). she's the wide-char sister, obsessed πΈ
curses(3X), curs_addch(3X), curs_addchstr(3X)
okay that's the whole page bestie, go forth and waddstr responsibly π«Άβ¨
this was ncurses 6.6, dated 2025-10-20, filed under curs_addstr(3X) β mwah, bye, love u ππ§π
π¦ 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 2019-2024,2025 Thomas E. Dickey
- Copyright 1998-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