[CentOS] program calls system() gettind PID - slightly off topic
garrick at usc.edu
Fri Oct 19 00:34:52 UTC 2007
On Thu, Oct 18, 2007 at 08:07:46PM -0400, Jerry Geis alleged:
> I have a C program on centos. When I call system("some_program &");
> how do I get the PID of the some_program?
> I cant just list processes as there might be more than one some_program
> I need to know the one that I just started.
You don't. At least not by using system().
Use fork() and exec() and you will have the child pid.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
More information about the CentOS