delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/10/07/11:04:15

From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: fortran scratch files II
Date: Sun, 07 Oct 2001 16:54:40 +0200
Lines: 36
Message-ID: <3BC06CB0.800EA173@is.elta.co.il>
References: <200110071400 DOT f97E0vj96328 AT postino3 DOT int DOT prima DOT com DOT ar>
NNTP-Posting-Host: 192.116.55.139
Mime-Version: 1.0
X-Trace: fu-berlin.de 1002466464 21122136 192.116.55.139 (16 [61365])
X-Mailer: Mozilla 4.7 [en] (Win98; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Orlando P. Hevia" wrote:
> 
> > I don't understand: you are supposed to close the file
> > before trying to open unit 52 again.  This program doesn't
> > close the file, so it will only be deleted when the
> > program exits.  What exactly are you trying to prove?
> 
> When you run the program, it aborts because the memory
> access violation (X(N) with N not defined) and you will
> have
> a forta52a file in your tmp directory. The CLOSE (52) line
> is not reached, the file is not correctly closed and it is
> not deleted.

Ah, I see now.

Well, this is a kind of feature: when a program crashes, the part of the
exit code which normally closes and removes scratch files is bypassed.  The
reason for this is DOS/Windows tradition, but this is also a valuable
debugging aid: if your program crashes, you might wish to look into any
scratch files it created for clues about the possible reasons for the crash.

If you want to make sure the scratch files are deleted even if the program
aborts, you can install a signal handler for SIGSEGV and make it call
`exit'.

> In some point, the program will abort, but by another
> reason: it cannot open a new scratch file. This is the
> second part (the more important for our users) of the
> problem, that was aborting the Alternative Transients
> Program (ATP).

It is probably a good idea to clean up the temporary directory from time to
time.  Since DJGPP uses its own temporary directory, pointed to by TMPDIR,
you could clean it up without worrying about other applications or the OS
itself.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019