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

Home » Public Forums » archive » Reading in a binary file in IDL - based on fortran reader?
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 in a binary file in IDL - based on fortran reader? [message #88900 is a reply to message #88898] Wed, 02 July 2014 06:17 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
On 07/02/14 09:05, rjp23@le.ac.uk wrote:
> I figured out reading the header in and the above seemed to work but I'm not sure how to progress on to a different record.
>
> The fortran code I have is similar to:
>
> READ(10,rec=1) a, b, c, d
> READ(10,rec=5) data
>
> I've been able to read in all the header info from "rec1" but how do I then proceed on to rec5?

Ah. A Fortran direct access file! IDL doesn't really have an equivalent
- a regular OPENR will give you stream file (I think that's the correct
term) just like C (or most anything else) would.

In IDL, to proceed onto record #5 (skipping recs 2-4) you can use the
POINT_LUN procedure. This will position the file pointer wherever you
want it.

Of course, you will have to know what the file record length is and
compute the position accordingly.

Note that the units of POINT_LUN are bytes. Some Fortran compilers
assume words (4-bytes) as the record length unit, so make sure you take
that into account if necessary. (And apologies if you already know this :o)

cheers,

paulv
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: band selection
Next Topic: Label dots in a Ternary plot

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

Current Time: Wed Oct 08 19:03:19 PDT 2025

Total time taken to generate the page: 0.00446 seconds