- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am getting a Fortran runtime error:End of file at the second line of this subroutine:
subroutine errstp(kunit)
backspace kunit
read(kunit, '(a)') zline(1:nline)
call cmerpr('unexpected end of file')
call cmerpr('last input data line:')
call cmerpr(zline(1:nline))
call finish(yes)
stop
end
kunit is 1 in this case, and the purpose of this subroutine is to echo the last inout line and then close up shop. Does my error have something to do with the backspace command or is this something else altogether?
Thanks
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We'd need to see more - ideally a complete program that could be run. We don't know where the file position is before the backspace. If it is "after the end-of-file marker - that is, an EOF condition has already been raised, one BACKSPACE will position the file just before the EOF marker. (The marker in this context is virtual - there is no physical representation, but this is how the standard describes it.) If you want to reread the last record after an EOF condition has been raised, you need two BACKSPACEs.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page