next up previous contents
Next: Going from C to Up: Data Format conversion Previous: A2B and B2A -   Contents

FTNSTRIP - Importing Fortran Data to C

Often, because Fortran is a popular language in seismic data processing, data may be obtained that was either created or processed in some way with Fortran. Binary data in Fortran are separated by beginning-of-record and end-of-record delimiters. Binary data created by C programs do not have any such delimiters. To use Fortran data in a C program requires that the Fortran labels be stripped off, via
ftnstrip < fortdata > cdata
This will produce C-style floats, most of the time. The program assumes that each record of fortran data is preceded and followed by an integer listing the size of the record in bytes. There have been fortran data types which have had only one or the other of these integer markers, but having both a beginning-of-record (BOR) and an end-of-record (EOR) markers seems to be standard today.

John Stockwell 2007-04-10