MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: reading Fortran unformatted files


  • To: mathgroup@smc.vnet.net
  • Subject: [mg11824] Re: reading Fortran unformatted files
  • From: Paul Abbott <paul@physics.uwa.edu.au>
  • Date: Tue, 31 Mar 1998 02:28:42 -0500
  • Organization: University of Western Australia
  • References: <6fi5jd$4pa@smc.vnet.net>

Paul Cally wrote:

> I would like to be able to read (and possibly write) unformatted fortran
> output files. The standard add-on package Utilities`BinaryFiles` is not
> the answer, since fortran unformatted output records (at least on unix
> machines) are padded at both ends with extra bytes. Most scientific
> software systems, e.g., idl, have a simple switch in their open
> statements to do this, but seemingly not Mathematica. Presumably, one
> would also need to specify BigEndian or LittleEndian, depending on
> which computer was being used.

This is controlled by the ByteOrder->LeastSignificantByteFirst option. 

The format in which integers are read is controlled by the ByteOrder
option. Integers can be treated as "least significant byte first" or
"little-endian" (a format most often found on machines based on Intel
processors, e.g., 386 and 486 MS-DOS, or on DEC VAX) instead of the
default "most significant byte first" or "big-endian" (a format found
on Motorola-based machines, e.g., Macintosh and many RISC-based
machines such as SPARC). This option is also available when converting
to binary form using ToBytes. 

> In principle, one could hack Utilities`BinaryFiles` to strip or append
> the necessary bytes. However, this assumes a knowledge of what these
> bytes actually are. Has anyone out there made such a hack, or some
> other workaround?

I had a look on deja news <http://www.dejanews.com/home_ps.shtml> for
all postings on Utilities`BinaryFiles` to
comp.soft-sys.math.mathematica but I could not see if your question had
been answered.

You might also want to look at "FastBinaryFiles: A MathLink Program for
Fast Reading 
and Writing of Binary Files" on MathSource <http://www.mathsource.com>

Cheers,
	Paul 

____________________________________________________________________ 
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia            Nedlands WA  6907       
mailto:paul@physics.uwa.edu.au  AUSTRALIA                            
http://www.pd.uwa.edu.au/~paul

            God IS a weakly left-handed dice player
____________________________________________________________________



  • Prev by Date: fractional simplification
  • Next by Date: Re: Questions about functions.
  • Prev by thread: reading Fortran unformatted files
  • Next by thread: Re: RE: Re: odd beha