Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!DDATHD21.BITNET!XBR2D96D From: XBR2D96D@DDATHD21.BITNET (Knobi der Rechnerschrat) Newsgroups: comp.sys.sgi Subject: Reading fortran "unformatted" files from C on the 4D. Message-ID: <8910250357.aa07723@SMOKE.BRL.MIL> Date: 25 Oct 89 06:55:13 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 31 Hallo, here comes a code fragment that reads (from C) a fortran "unformatted" file. Suppose the file has been fopen'ed to fp and that i1,i2,i3 are int's and that farr is a float-array. The programm then reads max fortran-records from the file, each record written by a fortran code like write(11) i1,i2,i3,farr ! with REAL farr(3) You have of course to know what is written in the records to interpret them correctly. For my opinion having the record-size included in the record is not as bad as somebody on the list told us. If you really need "C"-binary files, write a "C"-routine. Regards Martin Knoblauch TH-Darmstadt Phys. Chem. 1 Petersenstrasse 20 D-6100 Darmstadt, F.R.G. ------------------------------------------------------------------------------ for(iz=0;iz