Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!apple!amdahl!key!sjc From: sjc@key.COM (Steve Correll) Newsgroups: comp.lang.fortran Subject: Re: Position in file after open? Message-ID: <1160@key.COM> Date: 16 Oct 89 20:08:15 GMT References: <1162@atha.AthabascaU.CA> <50500152@uxe.cso.uiuc.edu> Organization: Key Computer Labs, Fremont, CA Lines: 34 lyndon@cs.AthabascaU.CA 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? In the Fortran77 standard, this is "processor dependent". mcdonald@uxe.cso.uiuc.edu writes: > Is "unknown" a standard contruct or not?...is there any legal way to > overwrite a file besides attempting to open it for read, and if there > closing it with a delete specifier, then opening a new file for write? STATUS='UNKNOWN' is standard Fortran77, but its effect is "processor dependent". johnl@esegue.segue.boston.ma.us writes: > I hope F8x is better, I await my copy of the standard eagerly. The Fortran88 draft provides STATUS='replace': if the file exists, you delete it; then you always create a new one. This raises interesting questions on a system (e.g. Unix) where deleting an old file and creating a new one is _not_ the same as opening the old file and truncating it to become empty. In Unix, in the former case, the "inode" will in general change, and any file descriptors already open on the old file will continue to see the contents of the old file without error or warning. If some implementors choose deletion and others truncation, programs which open the same file on multiple logical units may not be portable (though I suppose that without control over buffering, such programs are not portable anyway). The draft OPEN also provides POSITION={'ASIS','REWIND','APPEND'} to dictate the position of the file; and ACTION={'READ','WRITE','READWRITE'}. The latter doesn't solve any implementation problems which you may have encountered in Fortran77, since you must still provide Fortran77 behavior in its absence. -- ...{sun,pyramid}!pacbell!key!sjc Steve Correll