delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/09/17/11:30:08

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: calling unzip32 from C program
Date: 17 Sep 2004 15:15:48 GMT
Lines: 27
Message-ID: <2r0dd4F14ift1U1@uni-berlin.de>
References: <ciesel$60c$1 AT nsnmpen3-gest DOT nuria DOT telefonica-data DOT net>
X-Trace: news.uni-berlin.de iBbzSl4hb/5yOesZQegJ7gvTWU5ykmR65KVpMnzVowqlxC9xDXjAwbhhvu
X-Orig-Path: not-for-mail
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019