delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/09/17/13:45:05

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: =?ISO-8859-1?Q?Rafael_Garc=EDa?= <rafael_no_spam_no_ AT geninfor DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: calling unzip32 from C program
Date: Fri, 17 Sep 2004 19:06:34 +0200
Organization: Telefonica Data Espagna
Lines: 26
Message-ID: <cif5n1$79u$1@nsnmpen3-gest.nuria.telefonica-data.net>
References: <ciesel$60c$1 AT nsnmpen3-gest DOT nuria DOT telefonica-data DOT net> <2r0dd4F14ift1U1 AT uni-berlin DOT de>
NNTP-Posting-Host: 100.red-80-34-252.pooles.rima-tde.net
Mime-Version: 1.0
X-Trace: nsnmpen3-gest.nuria.telefonica-data.net 1095440929 7486 80.34.252.100 (17 Sep 2004 17:08:50 GMT)
X-Complaints-To: usenet AT nsnmpen3-gest DOT nuria DOT telefonica-data DOT net
NNTP-Posting-Date: Fri, 17 Sep 2004 17:08:49 +0000 (UTC)
User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207)
X-Accept-Language: es-es, es
In-Reply-To: <2r0dd4F14ift1U1@uni-berlin.de>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Hans-Bernhard Broeker escribió:

>>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 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.
> 
It's the same using or not a BAT file. I tried checking return code from 
  unzip32 in the BAT (after calling it) and it was '1', and if I call 
system("unzip32 prueba.zip") I get '1' too. See: if I call unzip32 from 
console or from a BAT executed from console, it returns 0; if I call 
unzip32 from a C program, via system(), or from a BAT file launched from 
a C program, it returns 1

- Raw text -


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