Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ncar!acd!pack From: pack@acd.uucp (Daniel Packman) Newsgroups: comp.unix.aix Subject: Re: pure binary files in fortran on RS6000 (xlf) Message-ID: <11512@ncar.ucar.edu> Date: 22 May 91 19:32:08 GMT References: <9105221902.AA08859@ucbvax.Berkeley.EDU> Sender: news@ncar.ucar.edu Organization: NCAR/Atmospheric Chemistry Division Lines: 33 In article <9105221902.AA08859@ucbvax.Berkeley.EDU> freese@dalvm41b.vnet.ibm.com ("Bradley T. Freese") writes: >fn@fractal.math.yale.edu (Francois Normant) writes: > >> I'm trying to write pure binary files in fortran in order to read them in C. >> ... >> The question is: > >> Is there a function equivalent to setpure in xlf (RS6000 fortran) ? > >No, xlf does not have such a function. However, xlf does not add any >extraneous characters to an unformatted file (other than an EOF >record). It only writes the data you write to the file. Depends on what you mean "extraneous". In order to support standard unformatted reads, a byte count at least must be accessable before the data. In order to support backspace and detection of "eof", byte counts of some sort must be added after the data. Counts of some sort somewhere must be added to the data stream for fortran unformatted io. AIX/RS6000 and *many* other unix fortran implementations on 32 bit machines prepend and postpend a 4 byte byte count of the intervening data. You are, of course, never guaranteed what the local fortran implementation of binary data is. We solve the problem of multi-architecture binary data by using the netCDF (common data format) routines. The package is free from unidata.ucar.edu and runs on VMS and DOS as well as unix machines. Its underlying assumption is the XDR (external data represention) which is used by NFS and other animals. Dan Packman NCAR INTERNET: pack@ncar.UCAR.EDU (303) 497-1427 P.O. Box 3000 CSNET: pack@ncar.CSNET Boulder, CO 80307-3000 DECNET SPAN: 9583::PACK