Mail Archives: djgpp/1995/11/22/01:05:17
> 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.
For spawnl*(), the argument list is like this:
spawnv(P_WAIT, program, argv[0], argv[1], ..., argv[N], 0);
Note that the program name is listed TWICE, once as the file to run,
and once as the argv[0] parameter to pass.
For spawnv*(), the third argument, ZIPFW, should be an array of char*
like this:
char *ZIPWF[] = {
"pkunzip",
"-v",
"somefile.zip",
0 };
As you can see, it represents the command line arguments (argv[*]),
and again, the first element is the program name, just like the second
argument to the function.
- Raw text -