scanw, wscanw, mvscanw, or mvwscanw Subroutine

Purpose

Calls the wgetstr subroutine on a window and uses the resulting line as input for a scan.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>

scanw( Format,  Argument1, Argument2, ...)
char *Format, *Argument1, ...;

wscanw( Window, Format, Argument1, Argument2, ...)
WINDOW *Window;
char *Format, *Argument1, ...;

mvscanw( Line,  Column, Format, Argument1, Argument2, ...)
int Line, Column;
char *Format, *Argument1, ...;

mvwscanw(Window, Line, Column, Format, Argument1, Argument2, ...)
WINDOW *Window;
int Line, Column;
char *Format, *Argument1, ...;

Description

The scanw, wscanw, mvscanw, and mvwscanw subroutines call the wgetstr subroutine on a window and use the resulting line as input for a scan. The mvscanw and mvwscanw subroutines move the cursor before performing the scan function. Use the scanw and mvscanw subroutines on the stdscr and the wscanw and mvwscanw subroutines on the user-defined window.

Parameters

Item Description
Argument Specifies the input to read.
Column Specifies the vertical coordinate to move the logical cursor to before performing the scan.
Format Specifies the conversion specifications to use to interpret the input. For more information about this parameter, see the discussion of the Format parameter in the scanf (scanf, fscanf, sscanf, or wsscanf Subroutine) subroutine.
Line Specifies the horizontal coordinate to move the logical cursor to before performing the scan.
Window Specifies the window to perform the scan in. You only need to specify this parameter with the wscanw and mvwscanw subroutines.

Example

The following shows how to read input from the keyboard using the scanw subroutine.

int id;
char deptname[25];
 
mvprintw(5,0,"Enter your i.d. followed by the department name:\n");
refresh();
scanw("%d %s", &id, deptname);
mvprintw(7,0,"i.d.: %d, Name: %s\n", id, deptname);
refresh();