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

Home » Public Forums » archive » Re: reading unformatted binary data (WRITEU) with FORTRAN routine
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: reading unformatted binary data (WRITEU) with FORTRAN routine [message #2613] Thu, 11 August 1994 11:37
nowicki is currently offline  nowicki
Messages: 11
Registered: May 1993
Junior Member
In article <11AUG199413273078@stars.gsfc.nasa.gov>, kucera@stars.gsfc.nasa.gov (Terry Kucera) writes:
> Well, this is sort of a FORTRAN question, but it has an IDL angle,
> so maybe someone here can help me.
> I've stored an array of floating points in an unformated binary data file
> using WRITEU in IDL. Can anyone tell me how to read the data back using
> FORTRAN? Terry Kucera
> kucera@stars.gsfc.nasa.gov

The following code works like a charm under OVMS 1.5 and IDL 3.6:

------------- IDL code to create an unformatted file ----------------
PRO temp

OPENW,lun,'temp.dat',400,/GET_LUN
FOR i = 0, 4 DO BEGIN
j = FINDGEN(100) * (i + 1)
WRITEU,lun,j
ENDFOR
FREE_LUN,lun

END

------------ Fortran code to read an unformatted file --------------
PROGRAM temp

IMPLICIT NONE

REAL*4
+ rec(100)
INTEGER*4
+ i, j

OPEN(UNIT=50, FILE='temp.dat', STATUS = 'OLD',
+ FORM='UNFORMATTED')
DO i = 1, 5
READ(50) (rec(j), j = 1, 100)
PRINT*,'rec',i
PRINT*,rec
PRINT*
END DO
CLOSE(50)
STOP
END

Good luck,

-Greg

/* Greg Nowicki | Mail Stop 401A | LIDAR Applications Group */
/* NASA Langley Research Center | Hampton, Virginia 23681-0001 */
/* Voice: (804) 864-2713 | FAX: (804) 864-7790 */
/* nowicki@tardis.larc.nasa.gov | My opinions and mine alone . . . */
[Message index]
 
Read Message
Previous Topic: Any fix for IDL + MacX?
Next Topic: a problem with IDL 3.6.1.a?

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

Current Time: Thu Oct 09 14:10:23 PDT 2025

Total time taken to generate the page: 0.95785 seconds