Binary Output/Input From/To IDL on PC?????? [message #1973] |
Tue, 19 April 1994 10:50  |
rlefevre
Messages: 4 Registered: April 1994
|
Junior Member |
|
|
I produce an array (145,73,10) in IDL. I open an output file (OPENW) and
write out binary data (WRITEU). I try to read the binary output into MS
Fortran PowerStation (on a PC). If I use a Fortran UNFORMATTED open, I get a
wrong file type error in Fortran. If I use a PowerStation BINARY open, it
works. However, only half the input array gets in, the other half is all 0s.
I think it has something to do with the "unformatted" data format.
Suggestions???
I have tried DIRECT ACCESS in Fortran.
I have tried XDR output in IDL.
When I use ASCII output/input all is fine--but I don't want to use ASCII.
Thanks.
----------
Randy J. Lefevre
Return e-mail to rlefevre@tamu.edu
|
|
|
Re: Binary Output/Input From/To IDL on PC?????? [message #2047 is a reply to message #1973] |
Tue, 26 April 1994 05:05  |
grunes
Messages: 68 Registered: September 1993
|
Member |
|
|
In article <1994Apr26.080731.17544@nenuphar.saclay.cea.fr> buteau@bali.saclay.cea.fr (A.Buteau 62 17) writes:
> From: buteau@bali.saclay.cea.fr (A.Buteau 62 17)
> Subject: Re: Binary Output/Input From/To IDL on PC??????
> Date: Tue, 26 Apr 1994 08:07:31 GMT
> Be very careful with the MS Fortran Unformatted Write.
> MS Fortran writes data with control blocks and this control blocks are not
> the same of other Fortran ( Sun Fortran for example) or Pv Wave.
>
> I had difficulties reading with Pv Wave data written by MS Fortran Unformatted Writes . The only solution I had was to carefully look in the MS manual how this Fortran writes data and control blocks and then with Pv Wave make a byte per byte read of the>data to discard the control blocks and to retrieve my data.
>
>
Ah, but under MS Fortran, one may read/write raw information (no control
blocks) with direct access statements, at least if the form is binary.
If you set the record length to 1, and increment the record # by the
number of bytes you have read or written, you will be OK. E.G.:
integer*4 i,j
open(1,file='filename',form='binary',access='direct',
& recl=1)
irec=1
read(1,rec=irec)i
irec=irec+4
read(1,rec=irec)j
...
As far as being the same as Sun Fortran, different brands of Fortran
for the Sun have produced different control blocks too.
On Sun Fortran, ordinary direct access opens:
open(1,file='filename',form='unformatted',access='direct',
& recl=1)
will read or write raw data.
|
|
|
Re: Binary Output/Input From/To IDL on PC?????? [message #2048 is a reply to message #1973] |
Tue, 26 April 1994 01:07  |
buteau
Messages: 9 Registered: September 1992
|
Junior Member |
|
|
Be very careful with the MS Fortran Unformatted Write.
MS Fortran writes data with control blocks and this control blocks are not
the same of other Fortran ( Sun Fortran for example) or Pv Wave.
I had difficulties reading with Pv Wave data written by MS Fortran Unformatted Writes . The only solution I had was to carefully look in the MS manual how this Fortran writes data and control blocks and then with Pv Wave make a byte per byte read of the data to discard the control blocks and to retrieve my data.
|
|
|