[SciPy-user] reading binary files written by a gfortran code...

fred fredmfp@gmail....
Mon Jun 16 06:24:09 CDT 2008

Benedikt Koenig a écrit :

> Unfortunately, I am not really familiar with fortran. The code I am
> using was not written by myself, I am just using the source code to
> compile on different platforms I am working on. So I am not the right
> one to ask about ways of Fortran.

Maybe a fortran guru ?
I can't believe there is no fortran guru here ;-)

> However, IIRC Fortran writes a marker before and after every record. If
> you write one real (4 byte) and you end up with 20 byte output this
> seems to me like you still have the markers of 8 byte length rather than
> the 4 bytes as should be the case using  -frecord-marker=4. Maybe you
> want to check the hex code, that is acutally written? The record markers
> should be 4 bytes length and contain the length of the record (in your
> case 1 real)
Well, hexdump gives me
0000000 0004 0000 0000 0000 0000 0000 0004 0000
0000010 0000 0000

On a binary file created with the intel version (so a 4 bytes file),
I get
0000000 0000 0000

The trick I don't understand is that if my file is 4 bytes length, there 
is no marker, no, as in the case of a binary file written by say a C code ?
Or I'm completely stupid ?

> BTW, which version of gfortran are you using? 
4.1.1 on debian etch box.



More information about the SciPy-user mailing list