Date: Fri, 18 May 2001 12:53:19 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: n DOT ratoandromanana AT bni DOT mg Message-Id: <2427-Fri18May2001125319+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9 CC: djgpp AT delorie DOT com In-reply-to: (n DOT ratoandromanana AT bni DOT mg) Subject: Re: spawn() problem. References: <3405-Fri18May2001104125+0300-eliz AT is DOT elta DOT co DOT il> 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 Precedence: bulk > Date: Fri, 18 May 2001 11:29:40 +0300 > From: "NirinaMichel Ratoandromanana/DF" > > eliz AT is DOT elta DOT co DOT il a crit: > >Please show a short test program which exhibits the problem. It is > >impossible to help you without seeing the code which fails. > > if (spawnvp(P_WAIT, "gcc", NULL) == -1) > printf ("spawn...() error!\n"); > What's wrong? The way you call spawnvp is incorrect. The prototype of this function, as documented in the library reference, is this: int spawnvp(int mode, const char *path, const char **argv); Your call puts a NULL pointer into the argv[] array passed to the child program. That's invalid usage: argv[] should at least have the argv[0] element non-NULL. Here's the correct way of doing this: char *argv[] = { "gcc", NULL }; if (spawnvp(P_WAIT, "gcc", argv) == -1) printf ("spawn...() error!\n");