🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #4565

Re: spawn problem

#4565
From: TomLiew
Date: Thu, 07 Feb 1991 02:09
35 lines
1759 bytes
In article <CHAS.91Feb3040833@stax.uchicago.edu> chas@stax.uchicago.edu (Charles Blair) writes:
>
>I'm spawning a child program written in assembly language from a
>parent written in C as follows:
>
>	spawnlp(P_WAIT,"WHATEVER.EXE","",NULL);
>	exit(0);
[ stuff deleted ...]

>
>--
>Bitnet:                 pmrcjdb@uchimvs1
>Internet:       cjdb@midway.uchicago.edu

You forgot arg0.  If you look inside the reference manual you fill find spawnlp defined as follows:

int spawnlp(int mode, char *cmdname, char *arg0, char *arg1,...,argn,NULL);

cmdname : Path name of the file to be executed.  
arg0,...argn : List of pointers to arguments, terminated by NULL.

At least one argument, arg0, must be passed to the child process(which 
sees it as argv[0]).  This argument is usually a copy of the cmdname 
i.e a pointer to the path

The statement should then be :
       spawnlp(P_WAIT,"whatever.exe","whatever",NULL);
       ......

*******************************************************
-- 
 Thomas Liew                    Internet : tomliew@itsgw.rpi.edu           
 Physics Dept. RPI              Bitnet   : fhv1@rpitsmts  
 Troy, NY12180
******************************************************************* 
Technical Details
Message-ID: <7Z^&X`#@rpi.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!tomliew
References: <CHAS.91Feb3040833@stax.uchicago.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!tomliew
From: tomliew@itsgw.rpi.edu (TomLiew)
Newsgroups: comp.os.msdos.programmer
Subject: Re: spawn problem
Message-ID: <7Z^&X`#@rpi.edu>
Date: 7 Feb 91 02:09:20 GMT
References: <CHAS.91Feb3040833@stax.uchicago.edu>
Organization: Rensselaer Polytechnic Institute, Troy NY
Lines: 35
Nntp-Posting-Host: jec423.its.rpi.edu
Sender: %N
Distribution: comp.sys.ibm.pc.programmer,comp.os.msdos.programmer