View topic - spawn(),exec(): child pid

spawn(),exec(): child pid

anything that doesn't fit to other groups.

spawn(),exec(): child pid

Postby ninja123 » Wed Apr 07, 2010 7:45 am

Hi All,


I want to create a child process that would start 'solitaire'(or any other game).
I want the pid of this game process.

How do I use spawnvp() in this context as spawn*() returns the pid of the process??

I tried the following:
Code: Select all
char *const parmList[] ={"sh", "-c", "/usr/photon/bin/solitaire", NULL};
............
pid_t  pid = 0;
pid = spawnvp(P_NOWAIT, "sh",parmList);


But the problem here is the return of 'pid' is the pid of the /bin/sh and not solitaire.

How do I change this?

Or is there any other way??

Thanks in advance
ninja123
Active Member
 
Posts: 36
Joined: Wed Dec 02, 2009 10:13 am

RE: spawn(),exec(): child pid

Postby mario » Wed Apr 07, 2010 10:53 am

then why do you start sh and not solitaire directly?
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am


Return to General Programming

Who is online

Users browsing this forum: No registered users and 1 guest