[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
Part1 - Part2 - Part3 - Part4 - Part5 - Single Page
Top Document: comp.os.msdos.programmer FAQ part 4/5
Previous Document: - How can I time events with finer resolution than the system clock's 55 ms (about 18 ticks a second)?
Next Document: - How can a program set DOS environment variables?
-
Search the FAQ Archives
Part1 - Part2 - Part3 - Part4 - Part5 - Single Page
Top Document: comp.os.msdos.programmer FAQ part 4/5
Previous Document:
Next Document:
- How can I find the error level of the previous program?
Date: 8 Feb 2002 20:21:49 -0400 First, which previous program are you talking about? If your current program ran another one, when the child program ends its error level is available to the program that spawned it. Most high-level languages provide a way to do this; for instance, in Turbo Pascal it's Lo(DosExitCode) and the high byte gives the way in which the child terminated. In Microsoft C, the exit code of a synchronous child process is the return value of the spawn- type function that creates the process. If your language doesn't have a function to return the error code of a child process, you can use INT 21 AH=4D (get return code). By the way, this will tell you the child's exit code and the manner of its ending (normal, Ctrl-C, critical error, or TSR). It's much trickier if the current program wants to get the error level of the program that ran and finished before this one started. G.A. Theall has published source and compiled code to do this; the code is downloadable as: <http://www.simtel.net/pub/pd/40610.html> (The code uses undocumented features in DOS 3.3 through 5.0. In the .DOC file Theall says that the values returned under 4DOS or other replacements won't be right.)
Top Document: comp.os.msdos.programmer FAQ part 4/5
Previous Document:
Next Document:
Part1 - Part2 - Part3 - Part4 - Part5 - Single Page
[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
Send corrections/additions to the FAQ Maintainer:
jeffrey@carlyle.org (Jeffrey Carlyle)
Last Update October 22 2009 @ 05:28 AM