Mail Archives: djgpp/2004/09/17/11:30:08
Rafael García <rafael_no_spam_no_ AT geninfor DOT com> wrote:
> I put this in a C program:
> ret=system("unzip prueba.zip");
> then I write an "unzip.bat" with:
> unzip32 %1 %2 %3 %4 %5 %6
> At execution, unzip32 works OK but return value from system is 1. When I
> execute unzip.bat from the console, errorlevel from unzip32 is 0 but
> when called from system in the C program, it returns 1.
If you ever want to look at return codes (called "ERRORLEVEL" only by
MS command line interpreters...), don't go through a .bat file.
Command.com has an unbelievably stupid feature: it won't tell you
anything about return levels of batch files, or of the programs they
executed.
For the case at hand, there's really nothing to be gained by having
that .bat file --- you could, and should, run unzip32.exe itself,
directly from your C program, or rename/copy unzip32.exe to unzip.exe,
if it's just the name "unzip" you're after.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -