JWM <
jwmw...@gmail.com> wrote:
> Or, since you're using that variable only to delete the file, try a
> system-independent method (between lines 419 and 430):
>
> !Delete the temporary file
> inquire (FILE = fileName, EXIST = fileFound)
> if (fileFound) then
> open (NEWUNIT = tmpUnit, FILE = fileName, ACTION = 'WRITE', STATUS
> = 'OLD', IOSTAT = ios)
> if (ios == 0) CLOSE (tmpUnit, STATUS = 'DELETE')
> endif
Unfortunately, that's not really system independent. It assumes that the
file in question can be opened as sequential access unformatted. It is
not necessarily so that you can open an arbitrary file that way on any
system. That is more than just an abstract possibility. I have seen
systems that would try to read at least the record header from the
initial record when opening the file. They would then get upset when the
first few bytes of the file did not look like a plausible unformatted
sequential record header for a reasonable record size.
I have had Fortran programs fail for exactly that reason, which is why
my personal library includes a delete_file subroutine in my collection
of system-dependent I/O routines. My default version of that subroutine
does things essentially identical to the above sample, but I do keep it
with my other system-dependent routines to facilitate porting in cases
where it doesn't work.
Not to speak of potential problems with permissions for opening with
action='write'. Yes, there are cases where you might have permissions to
delete a file, but not to write to it.
--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain