Content-type: text/html
curs_addwch, addwch, waddwch, mvaddwch, mvwaddwch, echowchar, wechowchar - Add a wchar_t character (with attributes) to a Curses window and advance cursor
#include <curses.h>
int addwch(
chtype wch
);
int waddwch(
WINDOW *win,
chtype wch
);
int mvaddwch(
int y,
int x,
chtype wch
);
int mvwaddwch(
WINDOW *win,
int y,
int x,
chtype wch
);
int echowchar(
chtype wch
);
int wechowchar(
WINDOW *win,
chtype wch
);
The addwch, waddwch, mvaddwch, and mvwaddwch routines put the character wch, holding a wchar_t character, into the window at the current cursor position of the window and advance the position of the window cursor. Their function is similar to that of putwchar in the Standard C Library. At the right margin, the routines perform an automatic newline. At the bottom of the scrolling region, if scrollok is enabled, the routines scroll the scrolling region up one line.
If wch is a tab, newline, or backspace, the routines move the cursor appropriately within the window. A newline also results in clrtoeol before moving. Tabs are considered to be at every eighth column. If wch is another control character, it is drawn in the ^X notation. Calling winwch after adding a control character does not return the control character, but instead returns the representation of the control character.
Video attributes can be combined with a wchar_t character in the parameter by means of an inclusive OR operation. This operation also sets the attributes. (The intent here is to allow text, including attributes, to be copied from one place to another by using inwch and addwch. See the discussion of standout, predefined video attribute constants, in the curs_attr(3) reference page.)
The
echowchar
and
wechowchar
routines
are functionally equivalent to a call to
addwch
followed
by a call to
refresh, or a call to
waddwch
followed by a call to
wrefresh. The knowledge that only
a single character is being output is taken into consideration and, for noncontrol
characters, a considerable performance gain may be realized by using these
routines instead of their equivalents.
The following variables may be used with routines of the addwch family to add line-drawing characters to the screen. When variables are defined for the terminal, the A_ALTCHARSET bit is turned on (see curs_attr(3)). Otherwise, the default character in the following list is stored in the variable. The variable names are consistent with the VT100 nomenclature.
Name | Default | Glyph Description |
ACS_ULCORNER | + | upper left-hand corner |
ACS_LLCORNER | + | lower left-hand corner |
ACS_URCORNER | + | upper right-hand corner |
ACS_LRCORNER | + | lower right-hand corner |
ACS_RTEE | + | right tee |
ACS_LTEE | + | left tee |
ACS_BTEE | + | bottom tee |
ACS_TTEE | + | top tee |
ACS_HLINE | - | horizontal line |
ACS_VLINE | | | vertical line |
ACS_PLUS | + | plus |
ACS_S1 | - | scan line 1 |
ACS_S9 | _ | scan line 9 |
ACS_DIAMOND | + | diamond |
ACS_CKBOARD | : | checker board (stipple) |
ACS_DEGREE | ' | degree symbol |
ACS_PLMINUS | # | plus/minus |
ACS_BULLET | o | bullet |
ACS_LARROW | < | arrow pointing left |
ACS_RARROW | > | arrow pointing right |
ACS_DARROW | v | arrow pointing down |
ACS_UARROW | ^ | arrow pointing up |
ACS_BOARD | # | board of squares |
ACS_LANTERN | # | lantern symbol |
ACS_BLOCK | # | solid square block |
The header file <curses.h> automatically includes the header file <stdio.h>.
Note that addwch, mvaddwch, mvwaddwch, and echowchar may be macros.
The routines described on this reference page are among the MNLS Curses
functions that are not included in the X/Open Curses CAE specification. MNLS
routines are supported only for backward compatibility reasons. Compaq
recommends the use of the
*add_wch
and
*echo_wchar
functions in new applications (see
curs_add_wch(3)).
All routines return the integer
ERR
upon
failure and
OK
upon successful completion,
unless otherwise noted in the preceding routine descriptions.
Functions: curses(3), curs_add_wch(3), curs_attr(3), curs_clear(3), curs_inch(3), curs_outopts(3), curs_refresh(3), putwc(3)