| Main index | Section 3 | Options |
#include <curses.h>int scanw(const char *fmt, ...); int wscanw(WINDOW *win, const char *fmt, ...); int mvscanw(int y, int x, const char *fmt, ...); int mvwscanw(WINDOW *win, int y, int x, const char *fmt, ...);
int vw_scanw(WINDOW *win, const char *fmt, va_list varglist);
/* obsolete */ int vwscanw(WINDOW *win, const char *fmt, va_list varglist);
vwscanw and vw_scanw are analogous to vscanf(3), and perform a wscanw using a variable argument list. The third argument is a va_list, a pointer to a list of arguments, as defined in stdarg.h.
In ncurses, failure occurs if vsscanf(3) returns EOF, or if the window pointer win is null.
Functions prefixed with mv first perform cursor movement and fail if the position (y, x) is outside the window boundaries.
ncurses implements vsscanf(3) internally if it is unavailable when the library is configured.
ncurses defines vw_scanw and vwscanw identically to support legacy applications. However, the latter is obsolete.
| &#187; | X/Open Curses, Issue 4 Version 2 (1996), marked vwscanw as requiring varargs.h and TO BE WITHDRAWN, and specified vw_scanw using the stdarg.h interface. |
| &#187; | X/Open Curses, Issue 5, Draft 2 (December 2007) marked vwscanw (along with vwscanw and the termcap interface) as withdrawn. After incorporating review comments, this became X/Open Curses, Issue 7 (2009). |
| &#187; | ncurses provides vwscanw, but marks it as deprecated. |
| &#187; | Since the underlying scanf(3) returns the number of successful conversions, and SVr4 curses was documented to use this feature, this may have been an editorial solecism introduced by X/Open, rather than an intentional change. |
| &#187; | This implementation retains compatibility with SVr4 curses. As of 2018, NetBSD curses also returns the number of successful conversions. Both ncurses and NetBSD curses call vsscanf(3) to scan the string, which returns EOF on error. |
| &#187; | Portable applications should test only if the return value is ERR, and not compare it to OK, since that value (zero) might be misleading. |
| One portable way to get useful results would be to use a %n conversion at the end of the format string, and check the value of the corresponding variable to determine how many conversions succeeded. | |
SVr2 (1984) documented scanw and wscanw tersely as scanf through stdscr and scanf through win, respectively.
SVr3 (1987) added mvscanw, and mvwscanw, stating
[t]hese routines correspond to scanf(3S), as do their arguments and return values. wgetstr() is called on the window, and the resulting line is used as input for the scan.
SVr3 also implemented vwscanw, describing its third parameter as a va_list, defined in varargs.h, and referred the reader to the manual pages for varargs and vprintf for detailed descriptions. (Because the SVr3 documentation does not mention vscanf, the reference to vprintf might not be an error).
SVr4 (1989) introduced no new variations of scanw, but provided for using either varargs.h or stdarg.h to define the va_list type.
X/Open Curses, Issue 4 (1995), defined vw_scanw to replace vwscanw, stating that its va_list type is defined in stdarg.h.
| 2024-04-20 | curs_scanw (3X) | ncurses 6.5 |
| Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | A child of 5 could understand this! Fetch me a child of 5. | ” |