Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!snorkelwacker!bu-cs!mirror!ima!esegue!johnl From: johnl@esegue.segue.boston.ma.us (John R. Levine) Newsgroups: comp.lang.fortran Subject: Re: Position in file after open? Message-ID: <1989Oct14.233757.8471@esegue.segue.boston.ma.us> Date: 14 Oct 89 23:37:57 GMT References: <1162@atha.AthabascaU.CA> Reply-To: johnl@esegue.segue.boston.ma.us (John R. Levine) Organization: Segue Software, Cambridge MA Lines: 31 In article <1162@atha.AthabascaU.CA> lyndon@cs.AthabascaU.CA (Lyndon Nerenberg) writes: >Can someone enlighten me as to what the ANSI F77 spec has to say >about where a file pointer sits immediately after an open? It doesn't say anything (and I just reread the section on OPEN for the zillionth time, just to be sure.) A standard conforming processor could position the file at the beginning, at the end, or at the 17th record. It could pick a different position every time. If you think this is stupid, then you understand the essence of F77 file processing. There is a lot of other stupid stuff, too, for example in an OPEN you can say whether the file is NEW or OLD, presumably so it can slap your wrist if you guessed wrong, but you can't say whether you intend to read, write, or both. I have written an F77 I/O system for Unix, and the backflips I had to go through to implementing it weren't pretty. When the user did an OPEN, I had to save the information and not really open the file until the first READ or WRITE, since opening an OLD file might mean that the user wanted to read it or wanted to append to it. There is no portable way to append to a file other than opening it, rewinding it, reading to the end, backspacing over the EOF record that the standard says is at the end of each file, and then writing. My impression is that there was a lot of arguing in the F77 committee among vendors with real file systems, vendors with no file systems, and vendors like IBM which were somewhere in between. They ended up with a compromise that is full of features that are so vague as to be useless. I hope F8x is better, I await my copy of the standard eagerly. -- John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650 johnl@esegue.segue.boston.ma.us, {ima|lotus|spdcc}!esegue!johnl Massachusetts has over 100,000 unlicensed drivers. -The Globe