]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/curs_addch.3x.html
ncurses 6.0 - patch 20150926
[ncurses.git] / doc / html / man / curs_addch.3x.html
1 <!-- 
2   * t
3   ****************************************************************************
4   * Copyright (c) 1998-2014,2015 Free Software Foundation, Inc.              *
5   *                                                                          *
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:                 *
13   *                                                                          *
14   * The above copyright notice and this permission notice shall be included  *
15   * in all copies or substantial portions of the Software.                   *
16   *                                                                          *
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.                               *
24   *                                                                          *
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       *
28   * authorization.                                                           *
29   ****************************************************************************
30   * @Id: curs_addch.3x,v 1.37 2015/09/05 21:13:25 tom Exp @
31 -->
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
33 <HTML>
34 <HEAD>
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">
40 </HEAD>
41 <BODY>
42 <H1 class="no-header">curs_addch 3x</H1>
43 <PRE>
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>
45
46
47
48
49 </PRE>
50 <H2><a name="h2-NAME">NAME</a></H2><PRE>
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
53        advance the cursor
54
55
56 </PRE>
57 <H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
58        <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
59
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>
66
67
68 </PRE>
69 <H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
70
71 </PRE>
72 <H3><a name="h3-Adding-characters">Adding characters</a></H3><PRE>
73        The  <STRONG>addch</STRONG>,  <STRONG>waddch</STRONG>, <STRONG>mvaddch</STRONG> and <STRONG>mvwaddch</STRONG> routines put the
74        character <EM>ch</EM> into the given window at its  current  window
75        position,  which  is then advanced.  They are analogous to
76        <STRONG>putchar</STRONG> in <STRONG>stdio(3)</STRONG>.  If the advance is at the right  mar-
77        gin:
78
79        <STRONG>o</STRONG>   The cursor automatically wraps to the beginning of the
80            next line.
81
82        <STRONG>o</STRONG>   At the bottom of the current scrolling region, and  if
83            <STRONG>scrollok</STRONG>  is enabled, the scrolling region is scrolled
84            up one line.
85
86        <STRONG>o</STRONG>   If <STRONG>scrollok</STRONG> is not enabled, writing a character at the
87            lower  right  margin  succeeds.   However, an error is
88            returned because it is not possible to wrap to  a  new
89            line
90
91        If <EM>ch</EM> is a tab, newline, carriage return or backspace, the
92        cursor is moved appropriately within the window:
93
94        <STRONG>o</STRONG>   Backspace moves the cursor one character left; at  the
95            left edge of a window it does nothing.
96
97        <STRONG>o</STRONG>   Carriage  return  moves  the cursor to the window left
98            margin on the current line.
99
100        <STRONG>o</STRONG>   Newline does a <STRONG>clrtoeol</STRONG>, then moves the cursor to  the
101            window  left  margin  on  the next line, scrolling the
102            window if on the last line.
103
104        <STRONG>o</STRONG>   Tabs are considered to be at every eighth column.  The
105            tab  interval  may  be  altered by setting the <STRONG>TABSIZE</STRONG>
106            variable.
107
108        If <EM>ch</EM> is any other control character, it is  drawn  in  <STRONG>^</STRONG><EM>X</EM>
109        notation.   Calling <STRONG>winch</STRONG> after adding a control character
110        does not return the character itself, but instead  returns
111        the ^-representation of the control character.
112
113        Video attributes can be combined with a character argument
114        passed to <STRONG>addch</STRONG> or related functions by logical-ORing them
115        into  the  character.   (Thus, text, including attributes,
116        can be copied from one place to  another  using  <STRONG>inch</STRONG>  and
117        <STRONG>addch</STRONG>.)   See  the <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG> page for values of prede-
118        fined video attribute constants that can be usefully OR'ed
119        into characters.
120
121
122 </PRE>
123 <H3><a name="h3-Echoing-characters">Echoing characters</a></H3><PRE>
124        The  <STRONG>echochar</STRONG>  and  <STRONG>wechochar</STRONG> routines are equivalent to a
125        call to <STRONG>addch</STRONG> followed by a call to <STRONG>refresh</STRONG>, or a call  to
126        <STRONG>waddch</STRONG> followed by a call to <STRONG>wrefresh</STRONG>.  The knowledge that
127        only a single character is being output is used  and,  for
128        non-control  characters,  a  considerable performance gain
129        may be seen by  using  these  routines  instead  of  their
130        equivalents.
131
132
133 </PRE>
134 <H3><a name="h3-Line-Graphics">Line Graphics</a></H3><PRE>
135        The  following  variables  may be used to add line drawing
136        characters to the screen with routines of the  <STRONG>addch</STRONG>  fam-
137        ily.   The  default  character listed below is used if the
138        <STRONG>acsc</STRONG>  capability  does  not  define  a   terminal-specific
139        replacement for it, or if the terminal and locale configu-
140        ration requires Unicode but the library is unable  to  use
141        Unicode.
142
143        The names are taken from VT100 nomenclature.
144
145        <EM>Name</EM>           <EM>Default</EM>   <EM>Description</EM>
146        --------------------------------------------------
147        ACS_BLOCK      #         solid square block
148        ACS_BOARD      #         board of squares
149        ACS_BTEE       +         bottom tee
150        ACS_BULLET     o         bullet
151        ACS_CKBOARD    :         checker board (stipple)
152        ACS_DARROW     v         arrow pointing down
153        ACS_DEGREE     '         degree symbol
154        ACS_DIAMOND    +         diamond
155        ACS_GEQUAL     &gt;         greater-than-or-equal-to
156        ACS_HLINE      -         horizontal line
157        ACS_LANTERN    #         lantern symbol
158        ACS_LARROW     &lt;         arrow pointing left
159        ACS_LEQUAL     &lt;         less-than-or-equal-to
160        ACS_LLCORNER   +         lower left-hand corner
161        ACS_LRCORNER   +         lower right-hand corner
162        ACS_LTEE       +         left tee
163        ACS_NEQUAL     !         not-equal
164        ACS_PI         *         greek pi
165        ACS_PLMINUS    #         plus/minus
166        ACS_PLUS       +         plus
167        ACS_RARROW     &gt;         arrow pointing right
168        ACS_RTEE       +         right tee
169        ACS_S1         -         scan line 1
170        ACS_S3         -         scan line 3
171        ACS_S7         -         scan line 7
172        ACS_S9         _         scan line 9
173        ACS_STERLING   f         pound-sterling symbol
174        ACS_TTEE       +         top tee
175        ACS_UARROW     ^         arrow pointing up
176        ACS_ULCORNER   +         upper left-hand corner
177        ACS_URCORNER   +         upper right-hand corner
178        ACS_VLINE      |         vertical line
179
180
181 </PRE>
182 <H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
183        All routines return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> on
184        success (the SVr4 manuals specify only "an  integer  value
185        other than <STRONG>ERR</STRONG>") upon successful completion, unless other-
186        wise noted in the preceding routine descriptions.
187
188        Functions with a "mv" prefix first perform a cursor  move-
189        ment  using  <STRONG>wmove</STRONG>, and return an error if the position is
190        outside the window, or if the window pointer is null.
191
192
193 </PRE>
194 <H2><a name="h2-NOTES">NOTES</a></H2><PRE>
195        Note that <STRONG>addch</STRONG>, <STRONG>mvaddch</STRONG>, <STRONG>mvwaddch</STRONG>, and  <STRONG>echochar</STRONG>  may  be
196        macros.
197
198
199 </PRE>
200 <H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
201        All  these functions are described in the XSI Curses stan-
202        dard, Issue 4.  The defaults specified  for  forms-drawing
203        characters apply in the POSIX locale.
204
205        X/Open  Curses  states  that the <EM>ACS</EM><STRONG>_</STRONG> definitions are <STRONG>char</STRONG>
206        constants.  For  the  wide-character  implementation  (see
207        <STRONG>curs_add_wch</STRONG>), there are analogous <EM>WACS</EM><STRONG>_</STRONG> definitions which
208        are <STRONG>cchar_t</STRONG> constants.
209
210        Some ACS symbols (ACS_S3, ACS_S7, ACS_LEQUAL,  ACS_GEQUAL,
211        ACS_PI,  ACS_NEQUAL,  ACS_STERLING) were not documented in
212        any publicly released System V.   However,  many  publicly
213        available  terminfos  include  <STRONG>acsc</STRONG> strings in which their
214        key characters (pryz{|}) are embedded, and  a  second-hand
215        list  of  their  character descriptions has come to light.
216        The  ACS-prefixed  names  for  them  were   invented   for
217        <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG>.
218
219        The  <EM>displayed</EM>  values  for  the  <EM>ACS</EM><STRONG>_</STRONG> and <EM>WACS</EM><STRONG>_</STRONG> constants
220        depend on
221
222        <STRONG>o</STRONG>   the library configuration, i.e., <STRONG>ncurses</STRONG> versus <STRONG>ncurs-</STRONG>
223            <STRONG>esw</STRONG>, where the latter is capable of displaying Unicode
224            while the former is not, and
225
226        <STRONG>o</STRONG>   whether the <EM>locale</EM> uses UTF-8 encoding.
227
228        In certain cases, the terminal is unable to display  line-
229        drawing  characters except by using UTF-8 (see the discus-
230        sion of <STRONG>NCURSES_NO_UTF8_ACS</STRONG> in <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG>).
231
232        The <STRONG>TABSIZE</STRONG> variable is implemented in  some  versions  of
233        curses, but is not part of X/Open curses.
234
235        If  <EM>ch</EM>  is  a  carriage return, the cursor is moved to the
236        beginning of the current row of the window.  This is  true
237        of other implementations, but is not documented.
238
239
240 </PRE>
241 <H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
242        <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>,
243        <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>,
244        <STRONG>putc(3)</STRONG>.
245
246        Comparable  functions  in  the  wide-character  (ncursesw)
247        library are described in <STRONG><A HREF="curs_add_wch.3x.html">curs_add_wch(3x)</A></STRONG>.
248
249
250
251                                                          <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG>
252 </PRE>
253 <div class="nav">
254 <ul>
255 <li><a href="#h2-NAME">NAME</a></li>
256 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
257 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
258 <ul>
259 <li><a href="#h3-Adding-characters">Adding characters</a></li>
260 <li><a href="#h3-Echoing-characters">Echoing characters</a></li>
261 <li><a href="#h3-Line-Graphics">Line Graphics</a></li>
262 </ul>
263 </li>
264 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
265 <li><a href="#h2-NOTES">NOTES</a></li>
266 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
267 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
268 </ul>
269 </div>
270 </BODY>
271 </HTML>