1 .\"***************************************************************************
2 .\" Copyright 2018-2022,2023 Thomas E. Dickey *
3 .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a *
6 .\" copy of this software and associated documentation files (the *
7 .\" "Software"), to deal in the Software without restriction, including *
8 .\" without limitation the rights to use, copy, modify, merge, publish, *
9 .\" distribute, distribute with modifications, sublicense, and/or sell *
10 .\" copies of the Software, and to permit persons to whom the Software is *
11 .\" furnished to do so, subject to the following conditions: *
13 .\" The above copyright notice and this permission notice shall be included *
14 .\" in all copies or substantial portions of the Software. *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 .\" Except as contained in this notice, the name(s) of the above copyright *
25 .\" holders shall not be used in advertising or otherwise to promote the *
26 .\" sale, use or other dealings in this Software without prior written *
28 .\"***************************************************************************
30 .\" $Id: curs_printw.3x,v 1.45 2023/12/18 00:03:28 tom Exp $
31 .TH curs_printw 3X 2023-12-17 "ncurses 6.4" "Library calls"
54 write formatted output to a \fIcurses\fR window
57 \fB#include <curses.h>
59 \fBint printw(const char *\fIfmt\fP, ...);
60 \fBint wprintw(WINDOW *\fIwin\fP, const char *\fIfmt\fP, ...);
61 \fBint mvprintw(int \fIy\fP, int \fIx\fP, const char *\fIfmt\fP, ...);
62 \fBint mvwprintw(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const char *\fIfmt\fP, ...);
64 \fBint vw_printw(WINDOW *\fIwin\fP, const char *\fIfmt\fP, va_list \fIvarglist\fP);
67 \fBint vwprintw(WINDOW *\fIwin\fP, const char *\fIfmt\fP, va_list \fIvarglist\fP);
75 are analogous to \fI\%printf\fP(3).
77 the string that would be output by \fI\%printf\fP(3) is instead output
78 as though \fB\%waddstr\fP(3X) were used with
82 as its first argument.
86 \fB\%vw_printw\fP are analogous to \fI\%vprintf\fP(3),
87 and perform a \fB\%wprintw\fP using a variable argument list.
88 The third argument is a \fI\%va_list\fP,
89 a pointer to a list of arguments,
90 as defined in \fI\%stdarg.h\fP.
92 These functions return
100 failure occurs if the library cannot allocate enough memory for the
101 buffer into which the output is formatted,
102 or if the window pointer
106 Functions with a \*(``mv\*('' prefix first perform a cursor movement
108 and fail if the position is outside the window.
110 No wide character counterpart functions are defined by the
113 configuration nor by any standard.
114 To format and write a wide-character string to a
117 consider using \fI\%swprintf\fP(3) and \fB\%waddwstr\fP(3X) or similar.
119 X/Open Curses, Issue 4, describes these functions.
120 It specifies no error conditions for them.
123 defines \fB\%vw_printw\fP and \fB\%vwprintw\fP identically to support
126 the latter is obsolete.
128 X/Open Curses, Issue 4, Version 2 (1996),
129 marked \fB\%vwprintw\fP as requiring \fI\%varargs.h\fP and
130 \*(``TO BE WITHDRAWN\*('',
131 and specified \fB\%vw_printw\fP using the \fI\%stdarg.h\fP interface.
133 X/Open Curses, Issue 5, Draft 2
134 (December 2007) marked \fBvwprintw\fP (along with
135 \fBvwscanw\fP and the termcap interface) as withdrawn.
136 After incorporating review comments,
138 X/Open Curses, Issue 7 (2009).
141 provides \fB\%vwprintw\fP,
142 but marks it as deprecated.
144 While \fB\%printw\fP was implemented in 4BSD
146 .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\
147 .\" libcurses/printw.c
148 it was unused until 4.2BSD
150 which employed it for games.
151 That early version of
153 preceded the ANSI C standard of 1989.
154 It did not use \fI\%varargs.h\fP,
155 though that had been available since Seventh Edition Unix (1979).
156 .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/include/\
159 (a couple of years after SVr4 was generally available,
160 and after the C standard was published),
161 other developers updated the library,
162 using \fI\%stdarg.h\fP internally in 4.4BSD
164 Even with this improvement,
167 did not use function prototypes
168 (nor even declare functions)
169 in \fI\%curses.h\fP until 1992.
171 SVr2 (1984) documented \fB\%printw\fP and \fB\%wprintw\fP tersely as
172 \*(``printf on \fB\%stdscr\fP\*('' and
173 \*(``printf on \fIwin\fP\*('',
176 SVr3 (1987) added \fB\%mvprintw\fP and \fB\%mvwprintw\fP,
177 with a three-line summary asserting that they were analogous to
179 explaining that the string that \fI\%printf\fP(3) would write to the
180 standard output stream would instead be output using \fB\%waddstr\fP to
182 SVr3 also implemented \fB\%vwprintw\fP,
183 describing its third parameter as a \fI\%va_list\fP,
184 defined in \fI\%varargs.h\fP,
185 and referred the reader to the manual pages for \fI\%varargs\fP and
186 \fI\%vprintf\fP for detailed descriptions.
188 SVr4 (1989) introduced no new variations of \fI\%printw\fP,
189 but provided for using either \fI\%varargs.h\fP or \fI\%stdarg.h\fP to
190 define the \fI\%va_list\fP type.
191 .\" either header declares "va_list", but only one can be used
193 X/Open Curses, Issue 4 (1995),
194 defined \fB\%vw_printw\fP to replace \fB\%vwprintw\fP,
195 stating that its \fI\%va_list\fP type is defined in \fI\%stdarg.h\fP.
198 \fB\%curs_addstr\fP(3X),
199 \fB\%curs_scanw\fP(3X),