3 ****************************************************************************
4 * Copyright (c) 1998-2011,2014 Free Software Foundation, Inc. *
6 * Permission is hereby granted, free of charge, to any person obtaining a *
7 * copy of this software and associated documentation files (the *
8 * "Software"), to deal in the Software without restriction, including *
9 * without limitation the rights to use, copy, modify, merge, publish, *
10 * distribute, distribute with modifications, sublicense, and/or sell *
11 * copies of the Software, and to permit persons to whom the Software is *
12 * furnished to do so, subject to the following conditions: *
14 * The above copyright notice and this permission notice shall be included *
15 * in all copies or substantial portions of the Software. *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
20 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
23 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
25 * Except as contained in this notice, the name(s) of the above copyright *
26 * holders shall not be used in advertising or otherwise to promote the *
27 * sale, use or other dealings in this Software without prior written *
29 ****************************************************************************
30 * @Id: curs_addch.3x,v 1.33 2014/05/24 19:47:41 tom Exp @
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
35 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
36 <meta name="generator" content="Manpage converted by man2html - see http://invisible-island.net/scripts/readme.html#others_scripts">
37 <TITLE>curs_addch 3x</TITLE>
38 <link rev=made href="mailto:bug-ncurses@gnu.org">
39 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
42 <H1>curs_addch 3x</H1>
45 <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG> <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG>
51 <H2><a name="h2-NAME">NAME</a></H2><PRE>
52 <STRONG>addch</STRONG>, <STRONG>waddch</STRONG>, <STRONG>mvaddch</STRONG>, <STRONG>mvwaddch</STRONG>, <STRONG>echochar</STRONG>, <STRONG>wechochar</STRONG> -
53 add a character (with attributes) to a <STRONG>curses</STRONG> window, then
58 <H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
59 <STRONG>#include</STRONG> <STRONG><curses.h></STRONG>
61 <STRONG>int</STRONG> <STRONG>addch(const</STRONG> <STRONG>chtype</STRONG> <STRONG>ch);</STRONG>
62 <STRONG>int</STRONG> <STRONG>waddch(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>ch);</STRONG>
63 <STRONG>int</STRONG> <STRONG>mvaddch(int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>ch);</STRONG>
64 <STRONG>int</STRONG> <STRONG>mvwaddch(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>ch);</STRONG>
65 <STRONG>int</STRONG> <STRONG>echochar(const</STRONG> <STRONG>chtype</STRONG> <STRONG>ch);</STRONG>
66 <STRONG>int</STRONG> <STRONG>wechochar(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>const</STRONG> <STRONG>chtype</STRONG> <STRONG>ch);</STRONG>
70 <H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
71 The <STRONG>addch</STRONG>, <STRONG>waddch</STRONG>, <STRONG>mvaddch</STRONG> and <STRONG>mvwaddch</STRONG> routines put the
72 character <EM>ch</EM> into the given window at its current window
73 position, which is then advanced. They are analogous to
74 <STRONG>putchar</STRONG> in <STRONG>stdio(3)</STRONG>. If the advance is at the right mar-
77 <STRONG>o</STRONG> The cursor automatically wraps to the beginning of the
80 <STRONG>o</STRONG> At the bottom of the current scrolling region, and if
81 <STRONG>scrollok</STRONG> is enabled, the scrolling region is scrolled
84 <STRONG>o</STRONG> If <STRONG>scrollok</STRONG> is not enabled, writing a character at the
85 lower right margin succeeds. However, an error is
86 returned because it is not possible to wrap to a new
89 If <EM>ch</EM> is a tab, newline, or backspace, the cursor is moved
90 appropriately within the window:
92 <STRONG>o</STRONG> Backspace moves the cursor one character left; at the
93 left edge of a window it does nothing.
95 <STRONG>o</STRONG> Newline does a <STRONG>clrtoeol</STRONG>, then moves the cursor to the
96 window left margin on the next line, scrolling the
97 window if on the last line.
99 <STRONG>o</STRONG> Tabs are considered to be at every eighth column. The
100 tab interval may be altered by setting the <STRONG>TABSIZE</STRONG>
103 If <EM>ch</EM> is any control character other than tab, newline, or
104 backspace, it is drawn in <STRONG>^</STRONG><EM>X</EM> notation. Calling <STRONG>winch</STRONG>
105 after adding a control character does not return the char-
106 acter itself, but instead returns the ^-representation of
107 the control character.
109 Video attributes can be combined with a character argument
110 passed to <STRONG>addch</STRONG> or related functions by logical-ORing them
111 into the character. (Thus, text, including attributes,
112 can be copied from one place to another using <STRONG>inch</STRONG> and
113 <STRONG>addch</STRONG>.) See the <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG> page for values of prede-
114 fined video attribute constants that can be usefully OR'ed
117 The <STRONG>echochar</STRONG> and <STRONG>wechochar</STRONG> routines are equivalent to a
118 call to <STRONG>addch</STRONG> followed by a call to <STRONG>refresh</STRONG>, or a call to
119 <STRONG>waddch</STRONG> followed by a call to <STRONG>wrefresh</STRONG>. The knowledge that
120 only a single character is being output is used and, for
121 non-control characters, a considerable performance gain
122 may be seen by using these routines instead of their
127 <H3><a name="h3-Line-Graphics">Line Graphics</a></H3><PRE>
128 The following variables may be used to add line drawing
129 characters to the screen with routines of the <STRONG>addch</STRONG> fam-
130 ily. The default character listed below is used if the
131 <STRONG>acsc</STRONG> capability does not define a terminal-specific
132 replacement for it. The names are taken from VT100 nomen-
135 <EM>Name</EM> <EM>Default</EM> <EM>Description</EM>
136 --------------------------------------------------
137 ACS_BLOCK # solid square block
138 ACS_BOARD # board of squares
139 ACS_BTEE + bottom tee
141 ACS_CKBOARD : checker board (stipple)
142 ACS_DARROW v arrow pointing down
143 ACS_DEGREE ' degree symbol
144 ACS_DIAMOND + diamond
145 ACS_GEQUAL > greater-than-or-equal-to
146 ACS_HLINE - horizontal line
147 ACS_LANTERN # lantern symbol
148 ACS_LARROW < arrow pointing left
149 ACS_LEQUAL < less-than-or-equal-to
150 ACS_LLCORNER + lower left-hand corner
151 ACS_LRCORNER + lower right-hand corner
153 ACS_NEQUAL ! not-equal
155 ACS_PLMINUS # plus/minus
157 ACS_RARROW > arrow pointing right
163 ACS_STERLING f pound-sterling symbol
165 ACS_UARROW ^ arrow pointing up
166 ACS_ULCORNER + upper left-hand corner
167 ACS_URCORNER + upper right-hand corner
168 ACS_VLINE | vertical line
172 <H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
173 All routines return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> on
174 success (the SVr4 manuals specify only "an integer value
175 other than <STRONG>ERR</STRONG>") upon successful completion, unless other-
176 wise noted in the preceding routine descriptions.
178 Functions with a "mv" prefix first perform a cursor move-
179 ment using <STRONG>wmove</STRONG>, and return an error if the position is
180 outside the window, or if the window pointer is null.
184 <H2><a name="h2-NOTES">NOTES</a></H2><PRE>
185 Note that <STRONG>addch</STRONG>, <STRONG>mvaddch</STRONG>, <STRONG>mvwaddch</STRONG>, and <STRONG>echochar</STRONG> may be
190 <H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
191 All these functions are described in the XSI Curses stan-
192 dard, Issue 4. The defaults specified for forms-drawing
193 characters apply in the POSIX locale.
195 X/Open Curses states that the <EM>ACS</EM><STRONG>_</STRONG> definitions are <STRONG>char</STRONG>
196 constants. For the wide-character implementation (see
197 <STRONG>curs_add_wch</STRONG>), there are analogous <EM>WACS</EM><STRONG>_</STRONG> definitions which
198 are <STRONG>cchar_t</STRONG> constants.
200 Some ACS symbols (ACS_S3, ACS_S7, ACS_LEQUAL, ACS_GEQUAL,
201 ACS_PI, ACS_NEQUAL, ACS_STERLING) were not documented in
202 any publicly released System V. However, many publicly
203 available terminfos include <STRONG>acsc</STRONG> strings in which their
204 key characters (pryz{|}) are embedded, and a second-hand
205 list of their character descriptions has come to light.
206 The ACS-prefixed names for them were invented for
207 <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG>.
209 The <STRONG>TABSIZE</STRONG> variable is implemented in some versions of
210 curses, but is not part of X/Open curses.
212 If <EM>ch</EM> is a carriage return, the cursor is moved to the
213 beginning of the current row of the window. This is true
214 of other implementations, but is not documented.
218 <H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
219 <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>, <STRONG><A HREF="curs_clear.3x.html">curs_clear(3x)</A></STRONG>, <STRONG><A HREF="curs_inch.3x.html">curs_inch(3x)</A></STRONG>,
220 <STRONG><A HREF="curs_outopts.3x.html">curs_outopts(3x)</A></STRONG>, <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>,
221 <STRONG>putc(3)</STRONG>.
223 Comparable functions in the wide-character (ncursesw)
224 library are described in <STRONG><A HREF="curs_add_wch.3x.html">curs_add_wch(3x)</A></STRONG>.
228 <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG>
232 <li><a href="#h2-NAME">NAME</a></li>
233 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
234 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
236 <li><a href="#h3-Line-Graphics">Line Graphics</a></li>
239 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
240 <li><a href="#h2-NOTES">NOTES</a></li>
241 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
242 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>