comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Trouble reading unformatted f77 (unix) integers?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Trouble reading unformatted f77 (unix) integers? [message #4156 is a reply to message #4155] Wed, 10 May 1995 00:00 Go to previous messageGo to previous message
evans is currently offline  evans
Messages: 1
Registered: May 1995
Junior Member
In article <3oqb90$l2l@harbinger.cc.monash.edu.au>, Brett Hennig
<bretth@lovelace.maths.monash.edu.au> writes:
> 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

The problem is that x, y, z are being initialized as integers
(2 bytes) rather than longs (4 bytes), while the fortran program
is writing out 4-byte integers.

Replacing the line
x=0 & y=0 & z=0
with
x=0L & y=0L & z=0L
will make the idl code work correctly.

Cheers!
Ian
------------------------------------------------------------ -----------
Ian Evans phone: +1-(410)-338-4756
FOS Scientist fax: +1-(410)-338-4767
Space Telescope Science Institute internet: evans@fos.stsci.edu
3700 San Martin Drive NSI/DECnet: stfosc::evans
Baltimore, MD 21218
U.S.A.

Disclaimer: The statements made herein reflect solely the opinions of
the author, and should in no way be construed as being representative
of the views of the Space Telescope Science Institute, the Association
of Universities for Research in Astronomy, or the National Aeronautics
and Space Administration.
------------------------------------------------------------ -----------
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Maker Interchange Format device driver
Next Topic: Trouble reading unformatted f77 (unix) integers?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Nov 30 08:06:23 PST 2025

Total time taken to generate the page: 0.47997 seconds