1curs_printw(3X)                                                curs_printw(3X)
2
3
4

NAME

6       printw, wprintw, mvprintw, mvwprintw, vwprintw, vw_printw - print
7       formatted output in curses windows
8

SYNOPSIS

10       #include <curses.h>
11
12       int printw(const char *fmt, ...);
13       int wprintw(WINDOW *win, const char *fmt, ...);
14       int mvprintw(int y, int x, const char *fmt, ...);
15       int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...);
16       int vw_printw(WINDOW *win, const char *fmt, va_list varglist);
17
18       /* obsolete */
19       int vwprintw(WINDOW *win, const char *fmt, va_list varglist);
20

DESCRIPTION

22       The printw, wprintw, mvprintw and mvwprintw routines are  analogous  to
23       printf  [see printf(3)].  In effect, the string that would be output by
24       printf is output instead as though waddstr were used on the given  win‐
25       dow.
26
27       The  vwprintw  and  vw_printw  routines  are  analogous to vprintf [see
28       printf(3)] and perform a wprintw using a variable argument  list.   The
29       third  argument  is a va_list, a pointer to a list of arguments, as de‐
30       fined in <stdarg.h>.
31

RETURN VALUE

33       Routines that return an integer return ERR upon failure  and  OK  (SVr4
34       only  specifies "an integer value other than ERR") upon successful com‐
35       pletion.
36
37       X/Open defines no error conditions.  In this implementation,  an  error
38       may be returned if it cannot allocate enough memory for the buffer used
39       to format the results.  It will return an error if the  window  pointer
40       is null.
41
42       Functions  with  a  “mv”  prefix  first perform a cursor movement using
43       wmove, and return an error if the position is outside the window, or if
44       the window pointer is null.
45

HISTORY

47       While printw was implemented in 4BSD, it was unused until 4.2BSD (which
48       used it in games).  That early version of curses was before the ANSI  C
49       standard.   It  did not use <varargs.h>, though that was available.  In
50       1991 (a couple of years after SVr4 was generally available,  and  after
51       the  C  standard  was published), other developers updated the library,
52       using <stdarg.h> internally in 4.4BSD curses.  Even with this  improve‐
53       ment, BSD curses did not use function prototypes (or even declare func‐
54       tions) in the <curses.h> header until 1992.
55
56       SVr2 documented printw, wprintw  tersely  as  “printf  on  stdscr”  and
57       tersely as “printf on win”, respectively.
58
59       SVr3  added  mvprintw,  and mvwprintw, with a three-line summary saying
60       that they were analogous to printf(3), explaining that the string which
61       would be output from printf(3) would instead be output using waddstr on
62       the given window.  SVr3 also added vwprintw, saying that the third  pa‐
63       rameter  is a va_list, defined in <varargs.h>, and referring the reader
64       to the manual pages for varargs and vprintf for detailed descriptions.
65
66       SVr4 added  no  new  variations  of  printw,  but  provided  for  using
67       <varargs.h> or <stdarg.h> to define the va_list type.
68
69       X/Open  Curses  added  vw_printw  to replace vwprintw, stating that its
70       va_list definition requires <stdarg.h>.
71

PORTABILITY

73       In this implementation, vw_printw and vwprintw are equivalent, to  sup‐
74       port legacy applications.  However, the latter (vwprintw) is obsolete:
75
76       •   The  XSI  Curses  standard, Issue 4 described these functions.  The
77           function vwprintw is marked TO BE WITHDRAWN, and is to be  replaced
78           by a function vw_printw using the <stdarg.h> interface.
79
80       •   The  Single Unix Specification, Version 2 states that vw_printw  is
81           preferred  to  vwprintw  since  the   latter   requires   including
82           <varargs.h>,  which  cannot be used in the same file as <stdarg.h>.
83           This implementation uses <stdarg.h> for both, because  that  header
84           is included in <curses.h>.
85
86       •   X/Open  Curses, Issue 5 (December 2007) marked vwprintw (along with
87           vwscanw and the termcap interface) as withdrawn.
88

SEE ALSO

90       curses(3X), curs_addstr(3X), curs_scanw(3X), curs_termcap(3X),
91       printf(3), vprintf(3).
92
93
94
95                                                               curs_printw(3X)
Impressum