Adds a string of multi-byte characters without rendition to a window and advances the cursor.
Curses Library (libcurses.a)
#include <curses.h>
int addnstr(const char *str,
int n);
int addstr(const char *str);
int mvaddnstr(int y,
int x,
const char *str,
int n);
int mvaddstr(int y,
int x,
const char *str);
int mvwaddnstr(WINDOW *win,
int y,
int x,
const char *str,
int n);
int mvwaddstr(WINDOW *win,
int y,
int x,
const char *str);
int waddnstr(WINDOW *win,
const char *str,
int n);
int waddstr(WINDOW *win,
const char *str);
These subroutines write the characters of the string str on the current or specified window starting at the current or specified position using the background rendition.
These subroutines advance the cursor position, perform special character processing, and perform wrapping.
The addstr, mvaddstr, mvwaddstr and waddstr subroutines are similar to calling mbstowcs on str, and then calling addwstr, mvaddwstr, mvwaddwstr, and waddwstr, respectively.
The addnstr, mvaddnstr, mvwaddnstr and waddnstr subroutines use at most, n bytes from str. These subroutines add the entire string when n is -1.
Item | Description |
---|---|
Column | Specifies the horizontal position to move the cursor to before adding the string. |
Line | Specifies the vertical position to move the cursor to before adding the string. |
String | Specifies the string to add. |
Window | Specifies the window to add the string to. |
Upon successful completion, these subroutines return OK. Otherwise, they return ERR.
char *xyz;
xyz="Hello!";
addstr(xyz);
mvaddstr(10, 5, "Hit a Key");
mvwaddstr(my_window, 10, 5, "xyz");
waddstr(my_window, "xyz");