delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/11/03:20:19

From: Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: writing of an exit value to screen or file
Date: Sat, 11 Mar 2000 22:31:35 +0000
Organization: Customer of Planet Online
Lines: 18
Message-ID: <28flcsofrhnbedev2q37gfle4h0vgjm28e@4ax.com>
References: <8a8nci$r6n$1 AT news DOT germany DOT net>
NNTP-Posting-Host: modem-89.potassium.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: newsg1.svr.pol.co.uk 952728082 8570 62.136.18.89 (10 Mar 2000 22:41:22 GMT)
NNTP-Posting-Date: 10 Mar 2000 22:41:22 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Agent 1.7/32.534
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> wrote:

> 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.

You could copy the DJGPP libc source code for exit() into you own code
and customise it by adding a printf().  Then any call to exit() would
run your own version (Not sure about the licence issues though).

At the command line you can use the redir utility with the -x switch:

C:\>redir -x myprog
MyProg ...
... done.
Exit code: 123

- Raw text -


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