You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
669 B
Fortran
26 lines
669 B
Fortran
SUBROUTINE ASKSTR(PROMPT, STRING)
|
|
C
|
|
C Prompt standard input for a string, and return that string.
|
|
C If just <return> is pressed, the passed string is not changed.
|
|
CHARACTER*(*) PROMPT,STRING
|
|
C
|
|
INTEGER STRLEN
|
|
CHARACTER*80 TMPSTR
|
|
C
|
|
STRLEN = LEN(STRING)
|
|
DO WHILE(STRING(STRLEN:STRLEN) .EQ. ' ')
|
|
IF (STRLEN .EQ. 1) GOTO 150
|
|
STRLEN = STRLEN - 1
|
|
END DO
|
|
150 CONTINUE
|
|
cdrc TYPE 10,PROMPT,STRING(1:STRLEN)
|
|
PRINT 10,PROMPT,STRING(1:STRLEN)
|
|
10 FORMAT(1X,A,' [',A,']: ',$)
|
|
READ(*,'(A)') TMPSTR
|
|
IF (TMPSTR .NE. ' ') THEN
|
|
STRING = TMPSTR
|
|
END IF
|
|
C
|
|
RETURN
|
|
END
|