Mail Archives: djgpp/1995/11/21/11:42:44
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 -