1curs_scanw(3X) curs_scanw(3X)
2
3
4
6 scanw, wscanw, mvscanw, mvwscanw, vwscanw, vw_scanw - convert formatted
7 input from a curses window
8
10 #include <curses.h>
11
12 int scanw(char *fmt, ...);
13 int wscanw(WINDOW *win, char *fmt, ...);
14 int mvscanw(int y, int x, char *fmt, ...);
15 int mvwscanw(WINDOW *win, int y, int x, char *fmt, ...);
16 int vw_scanw(WINDOW *win, char *fmt, va_list varglist);
17 int vwscanw(WINDOW *win, char *fmt, va_list varglist);
18
20 The scanw, wscanw and mvscanw routines are analogous to scanf [see
21 scanf(3)]. The effect of these routines is as though wgetstr were
22 called on the window, and the resulting line used as input for
23 sscanf(3). Fields which do not map to a variable in the fmt field are
24 lost.
25
26 The vwscanw and vw_scanw routines are analogous to vscanf. They per‐
27 form a wscanw using a variable argument list. The third argument is a
28 va_list, a pointer to a list of arguments, as defined in <stdarg.h>.
29
31 vwscanw returns ERR on failure and an integer equal to the number of
32 fields scanned on success.
33
34 Applications may use the return value from the scanw, wscanw, mvscanw
35 and mvwscanw routines to determine the number of fields which were
36 mapped in the call.
37
38 Functions with a "mv" prefix first perform a cursor movement using
39 wmove, and return an error if the position is outside the window, or if
40 the window pointer is null.
41
43 The XSI Curses standard, Issue 4 describes these functions. The func‐
44 tion vwscanw is marked TO BE WITHDRAWN, and is to be replaced by a
45 function vw_scanw using the <stdarg.h> interface. The Single Unix
46 Specification, Version 2 states that vw_scanw is preferred to vwscanw
47 since the latter requires including <varargs.h>, which cannot be used
48 in the same file as <stdarg.h>. This implementation uses <stdarg.h>
49 for both, because that header is included in <curses.h>.
50
51 Both XSI and The Single Unix Specification, Version 2 state that these
52 functions return ERR or OK. Since the underlying scanf can return the
53 number of items scanned, and the SVr4 code was documented to use this
54 feature, this is probably an editing error which was introduced in XSI,
55 rather than being done intentionally. Portable applications should
56 only test if the return value is ERR, since the OK value (zero) is
57 likely to be misleading. One possible way to get useful results would
58 be to use a "%n" conversion at the end of the format string to ensure
59 that something was processed.
60
62 curses(3X), curs_getstr(3X), curs_printw(3X), scanf(3)
63
64
65
66 curs_scanw(3X)