GETSTR()

Fortran version:

    SUBROUTINE GETSTR( PROMPT , DEFAULT, RESPONSE )
        CHARACTER*(*), INTENT(IN   ) :: PROMPT   ! Prompt for user
        CHARACTER*(*), INTENT(IN   ) :: DEFAULT  ! Default value
        CHARACTER*(*), INTENT(  OUT) :: RESPONSE ! Return value

NO C version:

Summary:

Display the PROMPT to standard output, get the user's response and check that it fits into RESPONSE, and return the result, issuing a warning if RESPONSE has had to be truncated. 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 like this: [Y].

See also GETVAL(), GETDATE(), GETDBLE() , GETMENU() , GETNUM() , GETREAL() , and GETYN().

Preconditions:

none

Fortran Usage:

For Fortran-90 declarations and interface checking:
    USE M3UTILIO
    

(See sample programs LATLON or PRESZ for additional usage examples.)

    ...
    CHARACTER*16   FNAME, DEFNAME
    INTEGER        IOS
    ...
    DEFNAME = 'AFILE'
    CALL GETSTR( 'Give me the input file name', DEFNAME, FNAME )
    OPEN( FILE = FNAME, UNIT = 11, IOSTAT = IOS ) !  opens the user's file
    ...

C Usage:

Don't, unless you're already comfortable with mixed-language programming.


Previous: GETREAL

Next: GETYN

Up: Utility Routines

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