Reading fortran "unformatted" files from C on the 4D.
"John R. Anderson", VLD/ASB
jra at BRL.MIL
Thu Oct 26 08:18:05 AEST 1989
Martin Knoblauch writes:
> for(iz=0;iz<max;iz++){
> nitem = fread(&dummy,4,1,fp);
> fread(&i1,sizeof(int),1,fp);
> fread(&i2,sizeof(int),1,fp);
> fread(&i3,sizeof(int),1,fp);
> fread(&farr[0],sizeof(float),3,fp);
> nitem = fread(&dummy,4,1,fp);
> }
Note that although this will work on an IRIS 4D, not all fortran
compilers create "unforamtted" files with the record length repeated
at the beginning and end of the record. I have seen some that only
include the record length at the start of each record. So depending
on this will create non-portable code.
-John
More information about the Comp.sys.sgi
mailing list