]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/curs_printw.3x.html
ncurses 6.4 - patch 20231007
[ncurses.git] / doc / html / man / curs_printw.3x.html
1 <!--
2   ****************************************************************************
3   * Copyright 2018-2022,2023 Thomas E. Dickey                                *
4   * Copyright 1998-2010,2017 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_printw.3x,v 1.41 2023/10/07 21:19:07 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 https://invisible-island.net/scripts/readme.html#others_scripts">
37 <TITLE>curs_printw 3x 2023-10-07 ncurses 6.4 Library calls</TITLE>
38 <link rel="author" href="mailto:bug-ncurses@gnu.org">
39
40 </HEAD>
41 <BODY>
42 <H1 class="no-header">curs_printw 3x 2023-10-07 ncurses 6.4 Library calls</H1>
43 <PRE>
44 <STRONG><A HREF="curs_printw.3x.html">curs_printw(3x)</A></STRONG>                  Library calls                 <STRONG><A HREF="curs_printw.3x.html">curs_printw(3x)</A></STRONG>
45
46
47
48
49 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
50        <STRONG>printw</STRONG>,  <STRONG>wprintw</STRONG>,  <STRONG>mvprintw</STRONG>,  <STRONG>mvwprintw</STRONG>,  <STRONG>vwprintw</STRONG>,  <STRONG>vw_printw</STRONG>  - write
51        formatted output to <EM>curses</EM> windows
52
53
54 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
55        <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
56
57        <STRONG>int</STRONG> <STRONG>printw(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>fmt</EM><STRONG>,</STRONG> <STRONG>...);</STRONG>
58        <STRONG>int</STRONG> <STRONG>wprintw(WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>fmt</EM><STRONG>,</STRONG> <STRONG>...);</STRONG>
59        <STRONG>int</STRONG> <STRONG>mvprintw(int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>fmt</EM><STRONG>,</STRONG> <STRONG>...);</STRONG>
60        <STRONG>int</STRONG> <STRONG>mvwprintw(WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>fmt</EM><STRONG>,</STRONG> <STRONG>...);</STRONG>
61        <STRONG>int</STRONG> <STRONG>vw_printw(WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>fmt</EM><STRONG>,</STRONG> <STRONG>va_list</STRONG> <EM>varglist</EM><STRONG>);</STRONG>
62
63        <EM>/*</EM> <EM>obsolete</EM> <EM>*/</EM>
64        <STRONG>int</STRONG> <STRONG>vwprintw(WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>fmt</EM><STRONG>,</STRONG> <STRONG>va_list</STRONG> <EM>varglist</EM><STRONG>);</STRONG>
65
66
67 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
68        The <STRONG>printw</STRONG>, <STRONG>wprintw</STRONG>, <STRONG>mvprintw</STRONG> and <STRONG>mvwprintw</STRONG> routines are  analogous  to
69        <STRONG>printf</STRONG>  [see <STRONG>printf(3)</STRONG>].  In effect, the string that would be output by
70        <STRONG>printf</STRONG> is output instead as though  <STRONG>waddstr</STRONG>  were  used  on  the  given
71        window.
72
73        The  <STRONG>vwprintw</STRONG>  and  <STRONG>vw_printw</STRONG>  routines  are  analogous to <STRONG>vprintf</STRONG> [see
74        <STRONG>printf(3)</STRONG>] and perform a <STRONG>wprintw</STRONG> using a variable argument  list.   The
75        third  argument  is  a  <STRONG>va_list</STRONG>,  a  pointer to a list of arguments, as
76        defined in <STRONG>&lt;stdarg.h&gt;</STRONG>.
77
78
79 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
80        Routines that return an integer return <STRONG>ERR</STRONG> upon failure  and  <STRONG>OK</STRONG>  (SVr4
81        only  specifies  "an  integer  value  other  than <STRONG>ERR</STRONG>") upon successful
82        completion.
83
84        X/Open defines no error conditions.  In this implementation,  an  error
85        may be returned if it cannot allocate enough memory for the buffer used
86        to format the results.  It will return an error if the  window  pointer
87        is null.
88
89        Functions  with  a  "mv"  prefix  first perform a cursor movement using
90        <STRONG>wmove</STRONG>, and return an error if the position is outside the window, or if
91        the window pointer is null.
92
93
94 </PRE><H2><a name="h2-HISTORY">HISTORY</a></H2><PRE>
95        While <STRONG>printw</STRONG> was implemented in 4BSD, it was unused until 4.2BSD (which
96        used it in games).  That early version of curses was before the ANSI  C
97        standard.   It  did not use &lt;varargs.h&gt;, though that was available.  In
98        1991 (a couple of years after SVr4 was generally available,  and  after
99        the  C  standard  was published), other developers updated the library,
100        using  &lt;stdarg.h&gt;  internally  in  4.4BSD  curses.   Even   with   this
101        improvement,  BSD  curses  did  not  use  function  prototypes (or even
102        declare functions) in the &lt;curses.h&gt; header until 1992.
103
104        SVr2 documented <STRONG>printw</STRONG>, <STRONG>wprintw</STRONG>  tersely  as  "printf  on  <EM>stdscr</EM>"  and
105        tersely as "printf on <EM>win</EM>", respectively.
106
107        SVr3  added  <STRONG>mvprintw</STRONG>,  and <STRONG>mvwprintw</STRONG>, with a three-line summary saying
108        that they were analogous to <STRONG>printf(3)</STRONG>, explaining that the string which
109        would be output from <STRONG>printf(3)</STRONG> would instead be output using <STRONG>waddstr</STRONG> on
110        the given window.  SVr3 also added  <STRONG>vwprintw</STRONG>,  saying  that  the  third
111        parameter  is  a  <STRONG>va_list</STRONG>,  defined  in  &lt;varargs.h&gt;, and referring the
112        reader to the  manual  pages  for  <EM>varargs</EM>  and  <STRONG>vprintf</STRONG>  for  detailed
113        descriptions.
114
115        SVr4  added  no  new  variations  of  <STRONG>printw</STRONG>,  but  provided  for using
116        &lt;varargs.h&gt; or &lt;stdarg.h&gt; to define the <STRONG>va_list</STRONG> type.
117
118        X/Open Curses added <STRONG>vw_printw</STRONG> to replace  <STRONG>vwprintw</STRONG>,  stating  that  its
119        <STRONG>va_list</STRONG> definition requires &lt;stdarg.h&gt;.
120
121
122 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
123        In  this  implementation,  <STRONG>vw_printw</STRONG>  and  <STRONG>vwprintw</STRONG>  are equivalent, to
124        support  legacy  applications.   However,  the  latter  (<STRONG>vwprintw</STRONG>)   is
125        obsolete:
126
127        <STRONG>o</STRONG>   The  XSI  Curses  standard, Issue 4 described these functions.  The
128            function <STRONG>vwprintw</STRONG> is marked TO BE WITHDRAWN, and is to be  replaced
129            by a function <STRONG>vw_printw</STRONG> using the <STRONG>&lt;stdarg.h&gt;</STRONG> interface.
130
131        <STRONG>o</STRONG>   The  Single Unix Specification, Version 2 states that <STRONG>vw_printw</STRONG>  is
132            preferred  to  <STRONG>vwprintw</STRONG>  since  the   latter   requires   including
133            <STRONG>&lt;varargs.h&gt;</STRONG>,  which  cannot be used in the same file as <STRONG>&lt;stdarg.h&gt;</STRONG>.
134            This implementation uses <STRONG>&lt;stdarg.h&gt;</STRONG> for both, because  that  header
135            is included in <STRONG>&lt;curses.h</STRONG>&gt;.
136
137        <STRONG>o</STRONG>   X/Open  Curses, Issue 5 (December 2007) marked <STRONG>vwprintw</STRONG> (along with
138            <STRONG>vwscanw</STRONG> and the termcap interface) as withdrawn.
139
140
141 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
142        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>,    <STRONG><A HREF="curs_addstr.3x.html">curs_addstr(3x)</A></STRONG>,    <STRONG><A HREF="curs_scanw.3x.html">curs_scanw(3x)</A></STRONG>,    <STRONG><A HREF="curs_termcap.3x.html">curs_termcap(3x)</A></STRONG>,
143        <STRONG>printf(3)</STRONG>, <STRONG>vprintf(3)</STRONG>
144
145
146
147 ncurses 6.4                       2023-10-07                   <STRONG><A HREF="curs_printw.3x.html">curs_printw(3x)</A></STRONG>
148 </PRE>
149 <div class="nav">
150 <ul>
151 <li><a href="#h2-NAME">NAME</a></li>
152 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
153 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a></li>
154 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
155 <li><a href="#h2-HISTORY">HISTORY</a></li>
156 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
157 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
158 </ul>
159 </div>
160 </BODY>
161 </HTML>