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

Home » Public Forums » archive » Re: Fortran unformatted data: Big or little endian
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: Fortran unformatted data: Big or little endian [message #34948 is a reply to message #34947] Wed, 30 April 2003 13:13 Go to previous messageGo to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"Michael Schroeter" <schroeter@muk.uni-hannover.de> wrote in message
news:b8og1i$6bt$1@newsserver.rrzn.uni-hannover.de...

> I have a problem reading Fortran unformatted data in IDL. I have a
> file containing data of well known size (e.g., an array of 100 x 100
> single precision floating point values). Unfortunately, I don't know
> something about the machine (big or little endian machine) on which
> the file has been produced. Is there a way to get this information
> on the fly by IDL in order to open the file automatically in the
> correctly (using the /SWAP_ENDIAN option or not). The way I used so
> far was trial and error. But since I have many of those files I'm
> searching for a solution without recompiling my source code.

If you have a reasonably recent version of IDL (>= 5.4??) and you know
the byte-order of the machine on which you're *reading* the data then
you can use OPEN's SWAP_IF_BIG_ENDIAN or SWAP_IF_LITTLE_ENDIAN
keywords. Here's the documentation entry for the former:

SWAP_IF_BIG_ENDIAN

Setting this keyword is equivalent to setting SWAP_ENDIAN; it only
takes effect if the current system has big endian byte
ordering. This keyword does not refer to the byte ordering of the
input data, but to the computer hardware.

--

Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Fortran unformatted data: Big or little endian
Next Topic: Re: WIDGET_TEXT - HOW TO NOT CHANGE VALUE OF TEXT WHILE EDITING FIELD?

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

Current Time: Thu Oct 09 21:40:59 PDT 2025

Total time taken to generate the page: 0.80441 seconds