NAME
getint, getlong, getshort - ask user to type an integer
value
SYNOPSIS
#include <stdio.h>
#include <ctype.h>
int getint
(prompt,min,max,defalt);
const char *prompt;
int min,max,defalt;
long getlong
(prompt,min,max,defalt);
const char *prompt;
long min,max,defalt;
short getshort
(prompt,min,max,defalt);
const char *prompt;
short min,max,defalt;
DESCRIPTION
Getint, getlong, and getshort ask the user to type in an
integer.
They begin by printing the
string prompt as a message to the user.
The user then types in a number. If the number is valid and
is
within the range min to max, then it is returned as the
value of
getint (getlong, getshort). If it is invalid or is out of
range,
then an error message is printed and the prompt-and-response
cycle
is repeated. If the user types just a carriage return, then
the
value defalt is assumed.
Getint, getlong, and getshort
are identical, except for the type of
the parameters and the results.
SEE ALSO
getbool(3), getstr(3), gethex(3), getstab(3), getdouble(3),
etc.
intarg(3), longarg(3), shortarg(3)