Fortran 77: Reading empty string
- From: "artheartscience" <steve@xxxxxxxxxxxxxxx>
- Date: 31 Jan 2006 11:12:10 -0800
I've written a simple finite automata simulator in Fortran 77, which
works except that I cannot successfully read in and process the empty
string. I've tried the following code, and in my READ statement I
supplied the END=13 which means "if the user just presses enter, goto
line 13". That means just proceed as normal...passing the empty string
to the FA function should work, but I haven't gotten a chance to test
it because although the code compiles using g77, I get a runtime error
which follows my code.
PROGRAM FASimulator
CHARACTER*25 str
10 WRITE(6,11)
11 FORMAT(1x, 'String: ', $)
READ(*, END=13) str
13 IF (FA(str).EQ.1) THEN
PRINT *, 'accepted'
ELSE
PRINT *, 'rejected'
END IF
GOTO 10
STOP
END
-----------------------------
natica% !g
g77 program2.f -o program2
natica% !.
../program2
String: sue: unformatted io not allowed
apparent state: unit 5 (unnamed)
lately reading sequential unformatted external IO
Abort
.
- Follow-Ups:
- Re: Fortran 77: Reading empty string
- From: Richard E Maine
- Re: Fortran 77: Reading empty string
- From: Michael Metcalf
- Re: Fortran 77: Reading empty string
- Prev by Date: Re: save attribute for module variables
- Next by Date: Detect undefined real variables?
- Previous by thread: Re: Why do you still use Fortran?
- Next by thread: Re: Fortran 77: Reading empty string
- Index(es):
Relevant Pages
|
|