Advertisement

03.21.2000 at 07:14AM PST, ID: 10314730
[x]
Attachment Details

Return ERRORLEVEL for batch file

Asked by rhobbs22 in C Programming Language

Tags: batch, errorlevel, file, return

I want t beable to use the batch file "ERRORLEVEL" based on the return value of my program.  

My program looks something like this:

int main(void)
{
  If (x == TRUE)
         return 1;
  else
         return 0;

return 0;
}

Based on that it should return the value. So when i call the command in my batch file:

@a:\mycprogram.exe
if errorlevel 0 goto Abort
if errorlevel 1 goto Next

As of now, it seems to not return a value, because I can use any errorlevel 1-??, and it will proceed.  If anyne can help I woul appreciate it.

Thanks in advance,
Rhobbs
Start Free Trial
[+][-]03.21.2000 at 07:21AM PST, ID: 2640447

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C Programming Language
Tags: batch, errorlevel, file, return
Sign Up Now!
Solution Provided By: slavik
Participating Experts: 1
Solution Grade: B
 
 
[+][-]03.21.2000 at 09:10AM PST, ID: 2640924

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32