Trouble reading unformatted f77 (unix) integers? [message #4158] |
Wed, 10 May 1995 00:00 |
Brett Hennig
Messages: 3 Registered: May 1995
|
Junior Member |
|
|
Here's the problem:
The F77 code:
open(unit=51,name='test1.dat',status='unknown',form='unforma tted')
write(51)1,2,3
close(51)
end
The idl code(that doesn't work):
openr,n,'test1.dat',/get_lun,/f77_unformatted
x=0 & y=0 & z=0
readu,n,x,y,z
print,x,y,z -----> 1 0 2
free_lun,n
end
Code that does:
openr,n,'test1.dat',/get_lun,/f77_unformatted
x=0 & y=0 & z=0 & dum1=0 & dum2=0
readu,n,x,dum1,y,dum2,z
print,x,dum1,y,dum2,z -----> 1 0 2 0 3
free_lun,n
end
is idl not interpreting the input correctly? or.. ? ?
|
|
|
|
Re: Trouble reading unformatted f77 (unix) integers? [message #4248 is a reply to message #4158] |
Wed, 10 May 1995 00:00  |
bowman
Messages: 121 Registered: September 1991
|
Senior Member |
|
|
In article <3oqmh1$nb6@post.gsfc.nasa.gov>,
thompson@orpheus.nascom.nasa.gov (William Thompson) wrote:
> Your problem is very simple. The default integer data type in FORTRAN takes up
> four bytes (INTEGER*4). In IDL parlance, this is known as a long integer. The
> default IDL integer type is a short integer which only takes up two bytes.
Having run into a number of gotchas with short integers (including this
one), I do wish there was a way to make LONG the default integer type in
IDL.
Ken Bowman
--
Dr. Kenneth P. Bowman 409-862-4060
Associate Professor 409-862-4132 fax
Department of Meteorology bowman@csrp.tamu.edu
Texas A&M University PP-Glider
College Station, TX 77843-3150
|
|
|
|