Re: reading binary files
- To: mathgroup at smc.vnet.net
- Subject: [mg21126] Re: reading binary files
- From: "P.J. Hinton" <paulh at wolfram.com>
- Date: Fri, 17 Dec 1999 01:21:24 -0500 (EST)
- Organization: "Wolfram Research, Inc."
- References: <firstname.lastname@example.org>
- Sender: owner-wri-mathgroup at wolfram.com
On 13 Dec 1999, Alberto Verga wrote: > Can Mathematica v4 read FORTRAN binary fliles? > > I created a file (in a Win NT 4 system, NTFS file system) using > standard fortran 90 (idem in 77) > > real*8 w(N,N) ! N=256 for example, a two dimensional double > precision array > open(10, file = 'w.dat', form = 'UNFORMATTED') !open fortran binary > file > write(10) w ! write data > close(10) !close file > > I tried to read it with > ReadListBinary["w.dat", Double, 256]; > (in order to get the first 256 values) without succes. What do you mean by the phrase "without success"? Did you get an error message, or did the kernel just echo back what you entered. If it was the latter, chances are you forgot to load the Mathematica package Utilities`BinaryFiles` before evaluating the function. This pitfall is discussed in Section 2.6.9 of _The Mathematica Book_ (Fourth Edition). To retrieve information on this topic in the online help, evaluate the following expression in a notebook: FrontEndExecute[ FrontEnd`HelpBrowserLookup[ "MainBook", "2.6.9" ] ] -- P.J. Hinton Mathematica Programming Group paulh at wolfram.com Wolfram Research, Inc. Disclaimer: Opinions expressed herein are those of the author alone.