Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EOF

Status
Not open for further replies.

GerritGroot

Technical User
Nov 3, 2006
291
ES
Hi,

I was using EOF to check for the end of file, like...

Code:
DO WHILE(.NOT.EOF(1))
   READ(1,*)MyVariable
END DO

But it doesn't seem to be standard fortran 90.

Is there a neat fortran 90 way to steer clear of this without using linenumbers (like ERR=100)?

Thanks,

Gerrit
 
You could try testing the IOSTAT in the READ for a -ve number.
 
Works great, thanks!

IOSTAT seems to be -1 on the EOF (just had to substract one from the counter, because EOF() changes just before reading the eof, while IOSTAT changes on the eof itself).

After some search, I noticed that IOSTAT=err number for other cases.

Gerrit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top