Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Blarged

macrumors newbie
Original poster
Apr 14, 2008
24
0
Ok, this seems elementary to me, but I can't for the life of me figure it out.

I need to launch an app from my c++ app. But I need to know the PID. Am I able to find this out from system() or popen()?

If I remember right, when you fork a process, the pid return value for the parent process is actual value of the child pid process, is that a way I could tackle this?
 

aaronw1986

macrumors 68030
Oct 31, 2006
2,622
10
Ok, this seems elementary to me, but I can't for the life of me figure it out.

I need to launch an app from my c++ app. But I need to know the PID. Am I able to find this out from system() or popen()?

If I remember right, when you fork a process, the pid return value for the parent process is actual value of the child pid process, is that a way I could tackle this?

Are you forking the process you want to open? If so, then yes, you can keep track when you fork.
 

Blarged

macrumors newbie
Original poster
Apr 14, 2008
24
0
Are you forking the process you want to open? If so, then yes, you can keep track when you fork.

I am not using a fork() call specifically. Currently I am just using system() which in itself uses fork().
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.