read binary file written in fortran format

Lars Schylberg larss at nada.kth.se
Mon Jun 26 22:14:49 AEST 1989


Hallo out there !

I have a problem with a binary data file that is written with
fortran.  I assume it is written on a 32 bit machine.

The person i got the data file from told me that the fortran
write format was:

5A2, 4F10.1, 2F7.1, 2I4
I7, 16F7.1 / 17F7.1

How do read this with a C-program ?  I started to read this with
fgets into a buffer.  But when I continued to unpack the buffer
with sscanf I ran into problem.  I'm sure there must be many clever 
solutions to this problem, but I haven't found any books that makes
this direct connection between fortran and C.

I would be most greatful for a solution.  If you could email solutions
to me, it would be best since I'm not a regular attender of this
group.  I will post the solutions that works back to this group.

Thanks in advance !

Lars Schylberg                           Email: larss at fmi.kth.se
Department of Photogrammetry             (Internet)
Royal Institute of Technolgy                    
S-100 44  STOCKHOLM, SWEDEN.             Tel. +46 8 790 86 33 (office)

-- 
Lars Schylberg                           Email: larss at fmi.kth.se
Department of Photogrammetry             (Internet)
Royal Institute of Technolgy                    
S-100 44  STOCKHOLM, SWEDEN.             Tel. +46 8 790 86 33 (office)



More information about the Comp.lang.c mailing list