Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.os.msdos.programmer FAQ part 4/5
Section - - How can I find the error level of the previous program?

( Part1 - Part2 - Part3 - Part4 - Part5 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Houses ]


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?
See reader questions & answers on this topic! - Help others by sharing your knowledge
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.)

User Contributions:

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA




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?

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 March 27 2014 @ 02:11 PM