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