GETNUM()

Fortran version:

    INTEGER FUNCTION GETNUM( LO , HI , DEFAULT , PROMPT )
        INTEGER         LO      ! Minimum allowed return value
        INTEGER         HI      ! Maximum allowed return value
        INTEGER         DEFAULT ! Default return value
        CHARACTER*(*)   PROMPT  ! Prompt for user

NO C version:

Summary:

Display the PROMPT to standard output for an integer between LO and HI, get the user's response and check that it is within range. Return DEFAULT if the user hits <RET>. Reprompts on error for up to 5 attempts; exits in case of more than 5 entry errors. If environment variable PROMPTFLAG is set to "N", returns DEFAULT without prompting the user. Logs the value returned, for tracking and validation purposes.

The default is displayed in square brackets at the end of the prompt [LIKE THIS]. For Fortran-90 declarations and interface checking:

    USE M3UTILIO
    

See also GETYN() , GETMENU() , GETREAL() , GETDBLE() , and GETSTR() .

Preconditions:

none

Fortran Usage:

(See sample programs LATLON or PRESZ for additional usage examples.)
    ...
    INTEGER        L, M
    INTEGER        GETNUM
    ...
    L = GETNUM( 1, 10, 7, 'Give me a number between 1 and 10' )
    ...

C Usage:

don't


Previous: GETMENU

Next: GETREAL

Up: Utility Routines

To: Models-3/EDSS I/O API: The Help Pages