addchstr, waddchstr, mvaddchstr, mvwaddchstr, addchnstr, waddchnstr, mvaddchnstr, mvwaddchnstr - add a
Contents
Description
waddchstr copies the string of curses characters chstr to the window win. A null curses character
terminates the string. waddchnstr does the same, but copies at most n characters, or as many as possible
if n is -1. ncurses(3NCURSES) describes the variants of these functions.
Because these functions do not call waddch(3NCURSES) internally, they are faster than waddstr(3NCURSES)
and waddnstr(3NCURSES). On the other hand, they
• do not treat the backspace, carriage return, or line feed characters specially;
• do not represent unprintable characters with unctrl(3NCURSES);
• do not update the cursor position to follow the last character written;
• truncate the string at the window's right margin, rather than wrapping it to the next line and
potentially scrolling.
History
SVr3.1 (1987) introduced these functions.
Name
addchstr, waddchstr, mvaddchstr, mvwaddchstr, addchnstr, waddchnstr, mvaddchnstr, mvwaddchnstr - add a
curses character string to a window
Notes
All of these functions except waddchnstr may be implemented as macros.
Portability
X/Open Curses Issue 4 describes these functions. It specifies no error conditions for them.
SVr4 describes a successful return value only as “an integer value other than ERR”.
Return Value
These functions return OK on success and ERR on failure.
In ncurses, they return ERR if
• win is NULL or
• chstr is NULL.
Functions prefixed with “mv” first perform cursor movement and fail if the position (y, x) is outside the
window boundaries.
See Also
add_wchstr(3NCURSES) describes comparable functions of the ncurses library in its wide-character configuration (ncursesw). ncurses(3NCURSES), addch(3NCURSES), addstr(3NCURSES) ncurses 6.5 2025-02-01 addchstr(3NCURSES)
Synopsis
#include<curses.h>intaddchstr(constchtype*chstr);intwaddchstr(WINDOW*win,constchtype*chstr);intmvaddchstr(inty,intx,constchtype*chstr);intmvwaddchstr(WINDOW*win,inty,intx,constchtype*chstr);intaddchnstr(constchtype*chstr,intn);intwaddchnstr(WINDOW*win,constchtype*chstr,intn);intmvaddchnstr(inty,intx,constchtype*chstr,intn);intmvwaddchnstr(WINDOW*win,inty,intx,constchtype*chstr,intn);
