Solved

Returning an error code from a command-line driven program

Posted on 2006-06-16
3
135 Views
Last Modified: 2010-04-05
Hi, I have written a simple exe that the user calls from the command line with various parameters. I can display messages if things go wrong, but some customers want error codes returned so that they can integrate it into their applications. But I am unsure how to do this. This is a windows application written in Delphi 7. I want to return a 0 or 1 etc.

Many thanks.
Gary
0
Comment
Question by:GaryHandley
3 Comments
 
LVL 10

Accepted Solution

by:
atul_parmar earned 100 total points
ID: 16918890
Just set ExitCode before you quit/terminate your application
e.g.
ExitCode := 1;
0
 
LVL 4

Assisted Solution

by:David_Ward
David_Ward earned 25 total points
ID: 16919312
Halt(0);
Halt(1);

... Halt(254) ... etc
0
 

Author Comment

by:GaryHandley
ID: 16919730
Many thanks, I knew it had to be something simple, but it was eluding me :-) Both solutions are useful, thanks.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question