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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

opening an unformatted file with fortran

Status
Not open for further replies.

martizzle

Programmer
Jun 23, 2008
5
US
I know the file is unformatted (what form, I don't know). But it contains about 8 arrays of like 19 (probably more)large numbers. The thing is, I get an error: end of file.
When I try to run it, and get the second number....
----
current code:

integer*4 nh
real*4 m200
open (unit=20,file,form='unformatted',status='old',err=100)
read (20) nh
read (20) m200
print*, nh, ' ', m200
----
 
You may need a record length. It has probably taken the whole file as 1 record so the second read will fail. Try setting a record length of 4.
 
Code:
open (unit=20,file,form='unformatted',status='old',err=100[COLOR=magenta], recl=4[/color])
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top