|
|
#include <ocurses.h>NOTESint scanw(fmt [, arg...]) char fmt;
EXAMPLE
#include <ocurses.h>main() { char string[100]; float number;
initscr(); cbreak(); /* Explained later in the */ echo(); /* section "Input Options" */ addstr("Enter a number and a string separated by a comma: "); refresh(); scanw("%f,%s",&number,string); clear(); printw("The string was \"%s\" and the number was %f. ", string,number); refresh(); endwin(); }
Notice the two calls to refresh. The first call updates the screen with the character string passed to addstr, the second with the string returned from scanw. Also notice the call to clear. Assume you entered the following when prompted: 2,twin. After running this program, your terminal screen would appear as follows:
The string was "twin" and the number was 2.000000.
$[]