readu/writeu oddity in xdr files [message #7180] |
Mon, 07 October 1996 00:00  |
Kile_Baker
Messages: 5 Registered: March 1994
|
Junior Member |
|
|
I'm not sure my original post ever got out to the network, since I've
seen no followup from anybody. So I will repost it. If you've seen
this already, my apologies.
I was sent the following program to read an XDR file.
function read_file,filename
openr,unit,/get_lun,filename,/xdr
time=''
filter=''
m=0
n=0
writeu,unit,time
writeu,unit,filter
writeu,unit,m,n
image=fltarr(m,n)
writeu,unit,image
close,unit
return,image
end
OK, the file was opened for READING, but from then on the program used
WRITEU statements, not READU. However, the program produced no errors,
and the really weird thing is that it actually does read the data from the
file and returns the desired image to the calling program.
This was done on an HP UNIX system. Does anyone know if the same
thing would happen on other systems? Is there some reason why it
is supposed to work this way?
By the way, this only works with files that have been opened with the
XDR keyword.
--
Kile Baker (kile_baker@jhuapl.edu) | All opinions are my own and
Johns Hopkins Applied Phys. Lab | not those of the JHU/APL
|
|
|