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

From: buers AT gmx DOT de (Dieter Buerssner)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: writing of an exit value to screen or file
Date: 9 Mar 2000 19:15:22 GMT
Lines: 24
Message-ID: <8a8t89$3dbeo$2@fu-berlin.de>
References: <8a8nci$r6n$1 AT news DOT germany DOT net>
NNTP-Posting-Host: pec-3-43.tnt2.s2.uunet.de (149.225.3.43)
Mime-Version: 1.0
X-Trace: fu-berlin.de 952629322 3583448 149.225.3.43 (16 [17104])
X-Posting-Agent: Hamster/1.3.13.0
User-Agent: Xnews/03.02.04
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

M DOT Czamai AT peak-system DOT com (Martin Czamai) 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?

You could try:

/* possibly in some header file, also stdio.h and stlib.h
   must be included somewhere */
#define exit my_exit
void my_exit(int);

/* your program */

#undef exit

void my_exit(int exit_code)
{
  printf("exitcode is %d\n", exit_code);
  exit(exit_code);
}

Dieter

- Raw text -


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