2 ****************************************************************************
3 * Copyright 2018-2022,2023 Thomas E. Dickey *
4 * Copyright 1998-2010,2017 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_printw.3x,v 1.47 2023/12/23 14:41:07 tom Exp @
31 * https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\
33 * https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/include/\
35 * either header declares "va_list", but only one can be used
37 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
40 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
41 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
42 <TITLE>curs_printw 3x 2023-12-23 ncurses 6.4 Library calls</TITLE>
43 <link rel="author" href="mailto:bug-ncurses@gnu.org">
47 <H1 class="no-header">curs_printw 3x 2023-12-23 ncurses 6.4 Library calls</H1>
49 <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>
54 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
55 <STRONG>printw</STRONG>, <STRONG>wprintw</STRONG>, <STRONG>mvprintw</STRONG>, <STRONG>mvwprintw</STRONG>, <STRONG>vwprintw</STRONG>, <STRONG>vw_printw</STRONG> - write
56 formatted output to a <EM>curses</EM> window
59 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
60 <STRONG>#include</STRONG> <STRONG><curses.h></STRONG>
62 <STRONG>int</STRONG> <STRONG>printw(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>fmt</EM><STRONG>,</STRONG> <STRONG>...);</STRONG>
63 <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>
64 <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>
65 <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>
67 <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>
69 <EM>/*</EM> <EM>obsolete</EM> <EM>*/</EM>
70 <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>
73 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
74 <STRONG>printw</STRONG>, <STRONG>wprintw</STRONG>, <STRONG>mvprintw</STRONG>, and <STRONG>mvwprintw</STRONG> are analogous to <STRONG>printf(3)</STRONG>.
75 In effect, the string that would be output by <STRONG>printf(3)</STRONG> is instead
76 output as though <STRONG><A HREF="curs_addstr.3x.html">waddstr(3x)</A></STRONG> were used with <EM>win</EM> (or <STRONG>stdscr</STRONG>) as its
79 <STRONG>vwprintw</STRONG> and <STRONG>vw_printw</STRONG> are analogous to <STRONG>vprintf(3)</STRONG>, and perform a
80 <STRONG>wprintw</STRONG> using a variable argument list. The third argument is a
81 <EM>va</EM><STRONG>_</STRONG><EM>list</EM>, a pointer to a list of arguments, as defined in <EM>stdarg.h</EM>.
84 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
85 These functions return <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> upon success.
87 In <EM>ncurses,</EM> failure occurs if the library cannot allocate enough memory
88 for the buffer into which the output is formatted, or if the window
89 pointer <EM>win</EM> is null.
91 Functions with a "mv" prefix first perform a cursor movement using
92 <STRONG>wmove</STRONG>, and fail if the position is outside the window.
95 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
96 No wide character counterpart functions are defined by the "wide"
97 <EM>ncurses</EM> configuration nor by any standard. To format and write a wide-
98 character string to a <EM>curses</EM> window, consider using <STRONG>swprintf(3)</STRONG> and
99 <STRONG><A HREF="curs_addwstr.3x.html">waddwstr(3x)</A></STRONG> or similar.
102 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
103 X/Open Curses, Issue 4, describes these functions. It specifies no
104 error conditions for them.
106 <EM>ncurses</EM> defines <STRONG>vw_printw</STRONG> and <STRONG>vwprintw</STRONG> identically to support legacy
107 applications. However, the latter is obsolete.
109 <STRONG>o</STRONG> X/Open Curses, Issue 4, Version 2 (1996), marked <STRONG>vwprintw</STRONG> as
110 requiring <EM>varargs.h</EM> and "TO BE WITHDRAWN", and specified <STRONG>vw_printw</STRONG>
111 using the <EM>stdarg.h</EM> interface.
113 <STRONG>o</STRONG> X/Open Curses, Issue 5, Draft 2 (December 2007) marked <STRONG>vwprintw</STRONG>
114 (along with <STRONG>vwscanw</STRONG> and the <EM>termcap</EM> interface) as withdrawn. After
115 incorporating review comments, this became X/Open Curses, Issue 7
118 <STRONG>o</STRONG> <EM>ncurses</EM> provides <STRONG>vwprintw</STRONG>, but marks it as deprecated.
121 </PRE><H2><a name="h2-HISTORY">HISTORY</a></H2><PRE>
122 While <STRONG>printw</STRONG> was implemented in 4BSD (November 1980), it was unused
123 until 4.2BSD (August 1983), which employed it for games. That early
124 version of <EM>curses</EM> preceded the ANSI C standard of 1989. It did not use
125 <EM>varargs.h</EM>, though that had been available since Seventh Edition Unix
126 (1979). In 1991 (a couple of years after SVr4 was generally available,
127 and after the C standard was published), other developers updated the
128 library, using <EM>stdarg.h</EM> internally in 4.4BSD <EM>curses.</EM> Even with this
129 improvement, BSD <EM>curses</EM> did not use function prototypes (nor even
130 declare functions) in <EM>curses.h</EM> until 1992.
132 SVr2 (1984) documented <STRONG>printw</STRONG> and <STRONG>wprintw</STRONG> tersely as "printf on <STRONG>stdscr</STRONG>"
133 and "printf on <EM>win</EM>", respectively.
135 SVr3 (1987) added <STRONG>mvprintw</STRONG> and <STRONG>mvwprintw</STRONG>, with a three-line summary
136 asserting that they were analogous to <STRONG>printf(3)</STRONG>, explaining that the
137 string that <STRONG>printf(3)</STRONG> would write to the standard output stream would
138 instead be output using <STRONG>waddstr</STRONG> to the given window. SVr3 also
139 implemented <STRONG>vwprintw</STRONG>, describing its third parameter as a <EM>va</EM><STRONG>_</STRONG><EM>list</EM>,
140 defined in <EM>varargs.h</EM>, and referred the reader to the manual pages for
141 <EM>varargs</EM> and <EM>vprintf</EM> for detailed descriptions.
143 SVr4 (1989) introduced no new variations of <EM>printw</EM>, but provided for
144 using either <EM>varargs.h</EM> or <EM>stdarg.h</EM> to define the <EM>va</EM><STRONG>_</STRONG><EM>list</EM> type.
146 X/Open Curses, Issue 4 (1995), defined <STRONG>vw_printw</STRONG> to replace <STRONG>vwprintw</STRONG>,
147 stating that its <EM>va</EM><STRONG>_</STRONG><EM>list</EM> type is defined in <EM>stdarg.h</EM>.
150 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
151 <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>printf(3)</STRONG>, <STRONG>vprintf(3)</STRONG>
155 ncurses 6.4 2023-12-23 <STRONG><A HREF="curs_printw.3x.html">curs_printw(3x)</A></STRONG>
159 <li><a href="#h2-NAME">NAME</a></li>
160 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
161 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a></li>
162 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
163 <li><a href="#h2-NOTES">NOTES</a></li>
164 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
165 <li><a href="#h2-HISTORY">HISTORY</a></li>
166 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>