delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/09/15:03:51

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: writing of an exit value to screen or file
Date: 09 Mar 2000 10:37:57 -0800
Organization: InterWorld Communications
Lines: 21
Message-ID: <8366uwat16.fsf@mercury.st.hmc.edu>
References: <8a8nci$r6n$1 AT news DOT germany DOT net>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 952627221 51294 134.173.45.219 (9 Mar 2000 18:40:21 GMT)
X-Complaints-To: usenet AT nntp1 DOT interworld DOT net
NNTP-Posting-Date: 9 Mar 2000 18:40:21 GMT
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Martin Czamai" <M DOT Czamai AT peak-system DOT com> writes:

> Hello out there!
> 
> Is it possible to display the exit value of a program on the screen BEFORE
> it terminates or is it just possible to evaluate the value at the DOS
> prompt?
> Currently I've registered an exit-handler by using atexit(..) and I want to
> display the value in this handler.
> Hoping for any reply thanks in advance

I can't think of a good way without wrapping exit.  Make a function
that sets a global variable to the exit code, and then calls exit, and
call it instead of exit.  (There are various clever ways to do this
without changing the source much, but a global find/replace is
probably simplest.)

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


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