Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!crdgw1!lamson From: lamson@sierra.crd.ge.com (scott h lamson) Newsgroups: comp.lang.fortran Subject: Re: File handling in Fortran 77 Message-ID: Date: 31 Aug 90 13:41:23 GMT References: <46016@masscomp.ccur.com> <1990Aug29.173235.9405@ux1.cso.uiuc.edu> <55875@iuvax.cs.indiana.edu> Sender: news@crdgw1.crd.ge.com Organization: GE Corporate Research & Development Lines: 32 In-reply-to: bomgard@copper.ucs.indiana.edu's message of 30 Aug 90 19:16:07 GMT In article <55875@iuvax.cs.indiana.edu> bomgard@copper.ucs.indiana.edu (Tim Bomgardner) writes: > From: bomgard@copper.ucs.indiana.edu (Tim Bomgardner) > > So how, in standard Fortran, do you dothe exact analog of the most primitive > > file operations - those expressed in C as flavors of get, put, and seek. > > It HAS to be possible to do this, as C requires it. > Rubbish. The answer is right there in front of you. Set RECL=1, > ACCESS='DIRECT' in the open statement. For those of you who don't > believe me, I'll be happy to email you fortran implementations of get, > put, and seek that use no tricks whatsoever. Not bad. I have used RECL=# bytes I wanted to write to a file, ACCESS='DIRECT', FORM='UNFORMATTED' and wrote the files all in one write statement with record # = 1 to produce a binary files readable by a C program, or to produce a file that was readable by C as part ASCII and part binary (Stardent's AVS field files to be specific). I don't know how universal this is, but it seems to work on convex, stardent and sun (all unix) without having any end-of-record or record length stuff tacked on. The ascii part of the AVS file was character data, and I needed to put line-feeds in the character strings explicitly (so that at least is not too portable). -- Scott| ARPA: lamson@crd.ge.com Lamson| UUCP: uunet!crd.ge.com!lamson (518)387-5795| UUCP: uunet!sierra.crd.ge.com!lamson General Electric Corporate Research and Development