Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!stat!stat.fsu.edu!mccalpin From: mccalpin@masig3.masig3.ocean.fsu.edu (John D. McCalpin) Newsgroups: comp.sys.sgi Subject: Re: Reading fortran "unformatted" files from C on the 4D. Message-ID: Date: 25 Oct 89 22:54:40 GMT References: <8910251818.aa09277@VAT.BRL.MIL> Sender: news@stat.fsu.edu Organization: Supercomputer Computations Research Institute Lines: 35 In-reply-to: jra@BRL.MIL's message of 25 Oct 89 22:18:05 GMT Martin Knoblauch writes: > for(iz=0;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); > } In article <8910251818.aa09277@VAT.BRL.MIL> jra@BRL.MIL ("John R. Anderson", VLD/ASB) replies: >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 That's why you have to use the same C routines to write the data, too.... Having IEEE binary compatibility does not do you any good if the record structures differ, and only C allows you to be absolutely specific about what you are writing and reading.... By the way, on the 4D machines, the control words can be eliminated by writing the file as "access='direct'" rather than "access='sequential'". Of course all the records have to be the same length in this case.... Direct access files have _no_ record marks of any type -- they are just like the "form='binary'" files on the IRIS 3000, and in fact are transportable between FORTRAN applications on the two families of machines.... -- John D. McCalpin - mccalpin@masig1.ocean.fsu.edu mccalpin@scri1.scri.fsu.edu mccalpin@delocn.udel.edu