Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!swrinde!ucsd!ogicse!milton!whit From: whit@milton.u.washington.edu (John Whitmore) Newsgroups: comp.lang.fortran Subject: Re: File handling in Fortran 77 Summary: A file is: a data structure, with (usually) contents. Message-ID: <6938@milton.u.washington.edu> Date: 31 Aug 90 07:11:41 GMT References: <1990Aug29.173235.9405@ux1.cso.uiuc.edu> <1990Aug30.132335.20164@ux1.cso.uiuc.edu> Organization: University of Washington, Seattle Lines: 37 In article <1990Aug30.132335.20164@ux1.cso.uiuc.edu> mcdonald@aries.scs.uiuc.edu (Doug McDonald) writes: > >>In Fortran, you can "seek" to a given record (if you've specified this >>desire in the OPEN statement, I think), but not to a given byte. >> > >I still don't understand why not. A file IS a sequence of bits. No, it most certainly is NOT. A file has a name; where is that name, in the sequence? A file has a creation date; where is that date? A file is a data structure, nothing less. It MAY have, as its CONTENTS, a sequence of bits, but there is NOTHING in the concept of a file that requires sequence. Nothing. Macintosh files, for instance, have header information, an indexed array of subfiles (the RESOURCE FORK, containing RESOURCES like fonts, I/O drivers, floating point packages, pictures, sounds, etc.) and a sequential subfile (the DATA FORK). There may be significant sequential information in the DATA fork, but the other two parts (header and resource fork) have well-defined structure which is not sequential. There are many useful files which have zero-length DATA fork, and retrieving information from these files requires asking the resource manager for the resources, by resource ID and type. This manager will load the whole resource into memory; there's no way to just grab a small part (certainly not to select a byte). To the extent that FORTRAN deals with such files, it does so with nonstandard constructions. C is no better in this regard. There are a number of things that FORTRAN simply doesn't bother with; RENAMING a file is a good example. Our FORTRAN code that needs that capability ends up calling on the C or Basic function library. If the structure has parts that you can't manipulate within the standard, you just have to have nonstandard manipulations, or do without. John Whitmore