www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/11/21/11:42:44

Date: Tue, 21 Nov 1995 15:30:48 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Cc: DJGPP AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Trouble spawning

On Tue, 21 Nov 1995, A.Appleyard wrote:

>   I have a Gnu C++ program that calls PKUNZIP.EXE thus:-
>     k=spawnl(P_WAIT,UNZIP,ZIPWF,0);
>   where P_WAIT is defined in #include<process.h>, UNZIP is a char* -> the full
> pathname of my copy of PKUNZIP.EXE, ZIPWF is a char* -> the full pathname of
> the zipfile that I want to unzip. But always when called thus, PKUNZIP behaves
> as it behaves when I call it directly from DOS without any arguments.

A case of misunderstanding the docs (which probably aren't clear 
enough).  The spawnXXX() family functions should be passed argv[0] twice: 
once as the full pathname and once as the first member in the arguments' 
array, like this:

   spawnl(P_WAIT, "c:/bin/pkzip.exe", "c:/bin/pkzip.exe", "file.zip", 0);

(One of the reasons for this double argument is compatibility to other 
implementations of C under DOS, but there might be others, I don't 
remember.) 

- Raw text -


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