ASK C-3

NAME

ask - ask parameter from terminal

SYNOPSIS

#include <cbase/dtypes.h>

char *ask (prompt, datatype, ans, anslen)

char *prompt;

int datatype;

char *ans;

int anslen;

DESCRIPTION

The prompt parameter is written to standard output, and one line is read from standard input. If the response is valid for the datatype specified, the response is written as a character string into the location pointed to by the ans parameter. A pointer to the response is also returned by ask.

If the response is longer than anslen-1 characters, or is not valid for the data type specified, an error message is written to standard output and the prompt is reissued. The error message displays the original input and what data type it should be, for example:

03/32/81 not a valid date

The valid datatypes are named in the include file and are:

BOOLEAN_TYPE MONEY_TYPE

CHAR_TYPE REAL_TYPE

DATE_TYPE STRING_TYPE

INT_TYPE TIME_TYPE