1curs_scanw(3X)                                                  curs_scanw(3X)
2
3
4

NAME

6       scanw, wscanw, mvscanw, mvwscanw, vwscanw, vw_scanw - convert formatted
7       input from a curses window
8

SYNOPSIS

10       #include <curses.h>
11
12       int scanw(const char *fmt, ...);
13       int wscanw(WINDOW *win, const char *fmt, ...);
14       int mvscanw(int y, int x, const char *fmt, ...);
15       int mvwscanw(WINDOW *win, int y, int x, const char *fmt, ...);
16       int vw_scanw(WINDOW *win, const char *fmt, va_list varglist);
17
18       /* obsolete */
19       int vwscanw(WINDOW *win, const char *fmt, va_list varglist);
20

DESCRIPTION

22       The scanw, wscanw and mvscanw routines  are  analogous  to  scanf  [see
23       scanf(3)].   The  effect  of  these  routines is as though wgetstr were
24       called on the  window,  and  the  resulting  line  used  as  input  for
25       sscanf(3).   Fields which do not map to a variable in the fmt field are
26       lost.
27
28       The vwscanw and vw_scanw routines are  analogous  to  vscanf(3).   They
29       perform a wscanw using a variable argument list.  The third argument is
30       a va_list, a pointer to a list of arguments, as defined in <stdarg.h>.
31

RETURN VALUE

33       vwscanw returns ERR on failure and an integer equal to  the  number  of
34       fields scanned on success.
35
36       Applications  may  use the return value from the scanw, wscanw, mvscanw
37       and mvwscanw routines to determine the  number  of  fields  which  were
38       mapped in the call.
39
40       Functions  with  a  "mv"  prefix  first perform a cursor movement using
41       wmove, and return an error if the position is outside the window, or if
42       the window pointer is null.
43

PORTABILITY

45       In this implementation, vw_scanw and vwscanw are equivalent, to support
46       legacy applications.  However, the latter (vwscanw) is obsolete:
47
48       ·   The XSI Curses standard, Issue 4 described these functions,  noting
49           that  the  function vwscanw is marked TO BE WITHDRAWN, and is to be
50           replaced by a function vw_scanw using the <stdarg.h> interface.
51
52       ·   The Single Unix Specification, Version 2 states that  vw_scanw   is
53           preferred   to   vwscanw   since   the  latter  requires  including
54           <varargs.h>, which cannot be used in the same file  as  <stdarg.h>.
55           This  implementation  uses <stdarg.h> for both, because that header
56           is included in <curses.h>.
57
58       ·   X/Open Curses, Issue 5 (December 2007) marked vwscanw  (along  with
59           vwprintw and the termcap interface) as withdrawn.
60
61       Both  XSI and The Single Unix Specification, Version 2 state that these
62       functions return ERR or OK.
63
64       ·   Since the underlying  scanf(3)  can  return  the  number  of  items
65           scanned, and the SVr4 code was documented to use this feature, this
66           is probably an editing error which was introduced  in  XSI,  rather
67           than being done intentionally.
68
69       ·   This  implementation  returns the number of items scanned, for com‐
70           patibility with SVr4  curses.   As  of  2018,  NetBSD  curses  also
71           returns  the  number  of  items  scanned.   Both ncurses and NetBSD
72           curses call vsscanf to scan the string, which returns EOF on error.
73
74       ·   Portable applications should only test if the return value is  ERR,
75           since the OK value (zero) is likely to be misleading.
76
77           One  possible way to get useful results would be to use a "%n" con‐
78           version at the end of the format string to  ensure  that  something
79           was processed.
80

SEE ALSO

82       curses(3X), curs_getstr(3X), curs_printw(3X), curs_termcap(3X),
83       scanf(3).
84
85
86
87                                                                curs_scanw(3X)
Impressum