[comp.lang.fortran] writing to nonempty file

ignacij@orion (Ignacy Misztal) (02/05/91)

In most compilers that I use, opening and writing to an existing file
results in overwriting the old contents. Not so in the IBM RS/6000, where
records are appended at the end of the file.  Everything is normal when one
rewinds the file right after the open statement. Which is the correct
semantics in view of standard Fortran 77?

Ignacy Misztal
University of Illinois
ignacy@uiuc.edu

khb@chiba.Eng.Sun.COM (Keith Bierman fpgroup) (02/05/91)

In article <ignacij.665698710@orion> ignacij@orion (Ignacy Misztal) writes:


   In most compilers that I use, opening and writing to an existing file
   results in overwriting the old contents. Not so in the IBM RS/6000, where
   records are appended at the end of the file.  Everything is normal when one
   rewinds the file right after the open statement. Which is the correct
   semantics in view of standard Fortran 77?

Alas both behaviors are perfectly legal. This was done to accomodate
existing practice which differed from system to system.

In Fortran90 this is resolved, there is an explicit APPEND mode.
--
----------------------------------------------------------------
Keith H. Bierman    kbierman@Eng.Sun.COM | khb@chiba.Eng.Sun.COM
SMI 2550 Garcia 12-33			 | (415 336 2648)   
    Mountain View, CA 94043