1curs_addch(3CURSES) Curses Library Functions curs_addch(3CURSES)
2
3
4
6 curs_addch, addch, waddch, mvaddch, mvwaddch, echochar, wechochar - add
7 a character (with attributes) to a curses window and advance cursor
8
10 cc [ flag ... ] file ... -lcurses [ library .. ]
11 #include <curses.h>
12
13 int addch(chtype ch);
14
15
16 int waddch(WINDOW *win, chtype ch);
17
18
19 int mvaddch(int y, int x, chtype ch);
20
21
22 int mvwaddch(WINDOW *win, int y, int x, chtype ch);
23
24
25 int echochar(chtype ch);
26
27
28 int wechochar(WINDOW *win, chtype ch);
29
30
32 With the addch(), waddch(), mvaddch(), and mvwaddch() routines, the
33 character ch is put into the window at the current cursor position of
34 the window and the position of the window cursor is advanced. Its func‐
35 tion is similar to that of putchar(). At the right margin, an automatic
36 newline is performed. At the bottom of the scrolling region, if scrol‐
37 lok() is enabled, the scrolling region is scrolled up one line.
38
39
40 If ch is a tab, newline, or backspace, the cursor is moved appropri‐
41 ately within the window. A newline also does a clrtoeol() before mov‐
42 ing. Tabs are considered to be at every eighth column. If ch is another
43 control character, it is drawn in the ^X notation. Calling winch()
44 after adding a control character does not return the control character,
45 but instead returns the representation of the control character. See
46 curs_inch(3CURSES).
47
48
49 Video attributes can be combined with a character by OR-ing them into
50 the parameter. This results in these attributes also being set. (The
51 intent here is that text, including attributes, can be copied from one
52 place to another using inch() and addch().) (see standout(), predefined
53 video attribute constants, on the curs_attr(3CURSES) page).
54
55
56 The echochar() and wechochar() routines are functionally equivalent to
57 a call to addch() followed by a call to refresh(), or a call to waddch
58 followed by a call to wrefresh(). The knowledge that only a single
59 character is being output is taken into consideration and, for non-con‐
60 trol characters, a considerable performance gain might be seen by using
61 these routines instead of their equivalents.
62
63 Line Graphics
64 The following variables may be used to add line drawing characters to
65 the screen with routines of the addch() family. When variables are
66 defined for the terminal, the A_ALTCHARSET bit is turned on (see
67 curs_attr(3CURSES)). Otherwise, the default character listed below is
68 stored in the variable. The names chosen are consistent with the VT100
69 nomenclature.
70
71
72
73
74 ┌────────────────────┬──────────────┬──────────────────────────┐
75 │ Name │ Default │ Glyph Description │
76 ├────────────────────┼──────────────┼──────────────────────────┤
77 │ACS_ULCORNER │+ │ upper left-hand corner │
78 ├────────────────────┼──────────────┼──────────────────────────┤
79 │ACS_LLCORNER │+ │ lower left-hand corner │
80 ├────────────────────┼──────────────┼──────────────────────────┤
81 │ACS_URCORNER │+ │ upper right-hand corner │
82 ├────────────────────┼──────────────┼──────────────────────────┤
83 │ACS_LRCORNER │+ │ lower right-hand corner │
84 ├────────────────────┼──────────────┼──────────────────────────┤
85 │ACS_RTEE │+ │ right tee │
86 ├────────────────────┼──────────────┼──────────────────────────┤
87 │ACS_LTEE │+ │ left tee │
88 ├────────────────────┼──────────────┼──────────────────────────┤
89 │ACS_BTEE │+ │ bottom tee │
90 ├────────────────────┼──────────────┼──────────────────────────┤
91 │ACS_TTEE │+ │ top tee │
92 ├────────────────────┼──────────────┼──────────────────────────┤
93 │ACS_HLINE │- │ horizontal line │
94 ├────────────────────┼──────────────┼──────────────────────────┤
95 │ACS_VLINE │| │ vertical line │
96 ├────────────────────┼──────────────┼──────────────────────────┤
97 │ACS_PLUS │+ │ plus │
98 ├────────────────────┼──────────────┼──────────────────────────┤
99 │ACS_S1 │- │ scan line 1 │
100 ├────────────────────┼──────────────┼──────────────────────────┤
101 │ACS_S9 │- │ scan line 9 │
102 ├────────────────────┼──────────────┼──────────────────────────┤
103 │ACS_DIAMOND │+ │ diamond │
104 ├────────────────────┼──────────────┼──────────────────────────┤
105 │ACS_CKBOARD │: │ checker board (stipple) │
106 ├────────────────────┼──────────────┼──────────────────────────┤
107 │ACS_DEGREE │' │ degree symbol │
108 ├────────────────────┼──────────────┼──────────────────────────┤
109 │ACS_PLMINUS │# │ plus/minus │
110 ├────────────────────┼──────────────┼──────────────────────────┤
111 │ACS_BULLET │o │ bullet │
112 ├────────────────────┼──────────────┼──────────────────────────┤
113 │ACS_LARROW │< │ arrow pointing left │
114 ├────────────────────┼──────────────┼──────────────────────────┤
115 │ACS_RARROW │> │ arrow pointing right │
116 ├────────────────────┼──────────────┼──────────────────────────┤
117 │ACS_DARROW │v │ arrow pointing down │
118 ├────────────────────┼──────────────┼──────────────────────────┤
119 │ACS_UARROW │^ │ arrow pointing up │
120 ├────────────────────┼──────────────┼──────────────────────────┤
121 │ACS_BOARD │# │ board of squares │
122 ├────────────────────┼──────────────┼──────────────────────────┤
123 │ACS_LANTERN │# │ lantern symbol │
124 ├────────────────────┼──────────────┼──────────────────────────┤
125 │ACS_BLOCK │# │ solid square block │
126 └────────────────────┴──────────────┴──────────────────────────┘
127
129 All routines return the integer ERR upon failure and an integer value
130 other than ERR upon successful completion.
131
133 See attributes(5) for descriptions of the following attributes:
134
135
136
137
138 ┌─────────────────────────────┬─────────────────────────────┐
139 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
140 ├─────────────────────────────┼─────────────────────────────┤
141 │MT-Level │Unsafe │
142 └─────────────────────────────┴─────────────────────────────┘
143
145 curs_attr(3CURSES), curs_clear(3CURSES), curs_inch(3CURSES), curs_out‐
146 opts(3CURSES), curs_refresh(3CURSES), curses(3CURSES), putc(3C),
147 attributes(5)
148
150 The header <curses.h> automatically includes the headers <stdio.h> and
151 <unctrl.h>.
152
153
154 Note that addch(), mvaddch(), mvwaddch(), and echochar() may be macros.
155
156
157
158SunOS 5.11 31 Dec 1996 curs_addch(3CURSES)