Getting the PID from system() or popen()

Discussion in 'Mac Programming' started by Blarged, Jun 18, 2008.

  1. macrumors newbie

    Joined:
    Apr 14, 2008
    #1
    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?
     
  2. macrumors 68030

    Joined:
    Oct 31, 2006
    #2
    Are you forking the process you want to open? If so, then yes, you can keep track when you fork.
     
  3. thread starter macrumors newbie

    Joined:
    Apr 14, 2008
    #3
    I am not using a fork() call specifically. Currently I am just using system() which in itself uses fork().
     
  4. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #4
    Wow, that's kind of a personal question. Isn't there a Hot Chat forum on MacRumors?
     

Share This Page