This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Appending data to pre-exisiting files
- From: Richard E Maine <Richard dot Maine at nasa dot gov>
- To: edwardss at whl dot co dot uk
- Cc: fortran at gcc dot gnu dot org
- Date: Wed, 27 Jul 2005 08:08:44 -0700
- Subject: Re: Appending data to pre-exisiting files
- References: <1122463667.19360.200.camel@george.gkn-whl.co.uk>
On Jul 27, 2005, at 4:27 AM, Steve Edwards wrote:
I have been trying to append data writes to exisiting data files using
g77 (3.4.1).
Your basic problem is that there is no simple portable way to do this
in Fortran 77.
Position='append' is a standard feature in f90 and thus will work with
all f90 compilers. But there is no simple standard way to do it in f77.
Some f77 compilers support the f90 form. The access='append' that you
noticed is a nonstandard form specific to a few compilers.
The only standard and portable way to do this in fortran 77 is to open
the file and read through it to the end (backspacing after you hit the
end of file). Yes, this is a pain - particularly if the file is large.
It is enough of a pain that it is sometimes worth doing nonstandard
things even though they cause porting problems.
As long as you have to stick to f77, it will continue o be a pain one
way or another.
I was under the impression that in
order to append data using g77 it was necessary to read to the EOF and
then backspace accordingly.
That's the only standard way; I don't recall whether g77 supports a
nonstandard form.
I haven't tested this with gfortran yet though,
Position='append' is standard f90. If it doesn't work with gfortran,
then that's a bug. I haven't checked.
--
Richard Maine | Good judgment comes from experience;
Richard.Maine@nasa.gov | experience comes from bad judgment.
| -- Mark Twain