Re: Unformatted data portability: Digital UNIX- [message #11346 is a reply to message #11239] |
Mon, 23 March 1998 00:00   |
wmc
Messages: 117 Registered: February 1995
|
Senior Member |
|
|
In article eckman@eos1.larc.nasa.gov, r.s.eckman@larc.nasa.gov (Richard Eckman) writes:
> I'm trying to do some post-processing of model results on a Windows95
> Intel-based platform using IDL. The model is running on a DEC Alpha
> machine running Digital UNIX. In IDL on the DEC platform, we can open
> the output files using the "/f77_unformatted" qualifier. When I try to open the same
> file on the Windows platform using IDL, I need to insert a "junk" variable
> at the start and end of the logical record to get it to read properly.
>
> For example, the file could be read on the DEC Alpha/UNIX platform using:
> openr,1,'file.dat',/f77
> readu,1,a,b,c
>
> On the Windows95 platform, I seem to need to do the following:
> openr,1,'file.dat'
> readu,1,junk,a,b,c,junk
>
> Is there any way around modifying all of our IDL codes on the Windows platform?
The "junk" 4-bytes is the length of the record (for some reason, repeated
at the end of the record too).
You could try your fortran manual for the code that writes the files - perhaps
it is prepared to write a byte-stream rather than fortran-unformatted.
Alternatively, if your file only has one record it it, you can use "head" and "tail"
to cut off the first and last 4 bytes.
> Of course, the "/f77" keyword in the open statement won't work under Windows
> 95. In a more general sense, is this "almost" binary portability unique to the
> Digital UNIX/Windows95(or NT) combination or could I have written the file from
> a SUN or SGI and read it on a Windows95 Intel-based machine in the same way?
SUNs and SGIs (and everything else, in fact) are byteswapped; but this can be
cured with "byteorder". (Errm, thats looking at it from the alpha perspective...)
- William
---
William M Connolley | wmc@bas.ac.uk | http://www.nbs.ac.uk/public/icd/wmc/
Climate Modeller, British Antarctic Survey | Disclaimer: I speak for myself
|
|
|