tags:

views:

70

answers:

1

im running a file using system, but i dont know how to get the pid of that process, does anybody know it?

thnx!

+2  A: 

You might want to use fork and exec instead of system. The child process pid will be returned from fork to the parent process.

Edit in case it wasn't obvious, my answer was before the author tagged his post with windows. My answer is specific to Linux.

Sam Miller
But I would say, the same logic applies even though functions the OPer has to use are not fork and exec but Windows API func instead. Usually (not always, but often) system is a bad idea, expecially if you want some kind of "control"
ShinTakezou