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

Home » Public Forums » archive » read/write to /XDR file?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
read/write to /XDR file? [message #7104] Wed, 02 October 1996 00:00
Kile_Baker is currently offline  Kile_Baker
Messages: 5
Registered: March 1994
Junior Member
I was sent the following IDL function designed to read an unformatted
data file written in XDR form. Take a look at it and tell me why it works!
----------------------
function read_file,file

openr, unit, /get, file, /xdr

infile=''
filter=''
time=''
n=0
m=0
writeu, unit, infile
writeu, unit, filter
writeu, unit, time
writeu, unit, n, m
image = intarr(n,m)
lat = dblarr(n,m)
lon = dblarr(n,m)
writeu, unit, image
writeu, unit, lat
writeu, unit, lon

free_lun, unit
return, {image: image, lat:lat, lon:lon, infile:infile, $
time:time, filter:filter}
end
--------------------------
No, I didn't make a mistake typing this. The file is opened for READING,
but then the instructions say to WRITE unformatted data to this readonly
file. There are no errors produced, and miraculously, the structure
that is returned contains all the data from the file.

This was done on an HP UNIX system. Does the same thing work on
other systems? How and why?

--
Kile Baker (kile_baker@jhuapl.edu) | All opinions are my own and
Johns Hopkins Applied Phys. Lab | not those of the JHU/APL
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL 5.0
Next Topic: Re: PV-Wave CONTOUR question?

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

Current Time: Wed Oct 08 19:25:47 PDT 2025

Total time taken to generate the page: 0.00559 seconds