[gambit-list] Reading binary files

Adrien Pierard adrien.pierard at etu.upmc.fr
Tue Dec 18 11:14:46 EST 2007


Siegfried Gonzi wrote:
> Hello:
>   
Hello
> Is there an easy way in Gambit to read binary files? I have got binary files created on my desktop Linux machine with the help of IDL. The binary files are created in Fortran 77 binary format and BIG_ENDIAN mode (IDL has such a feature). I read the files from a data base with IDL and store it in big_endian Fortran 77.
>
> I'd like to read it on my Macintosh. However, the gdl clone of idl has some problems with that particular files (I scp it from my desktop machine).
>
> The first 3 numbers in the file are Fortran integer numbers which describe the 3d dimension of the array and the following numbers in the binary file are the content of the array.
>
> Or do I need a C-binding?
>   
I guess that Fortran's integers have a fixed length. Therefore, you
should be able to read integers byte after byte, and reorder them.
It's no fun, but should be easy to do.
read-char, eof-object?, char->integer... However, it might be harder,
depending on the kind of data of your array.

> Thanks very much,
> Siegfried Gonzi
>   

Adrien.

-- 
Le café fait dormir, lorsqu'on en boit pas. 




More information about the Gambit-list mailing list