linux - How to get the pid of a process started using system call? -


in c program, in main calling system function using system(). want pid of process started system(). there way pid ?

no, , in general it's not useful. when call of system() returns program, child process has terminated , been reaped, there's no process (not zombie process) reference.

if need start process , retain pid, you'll need fork() child (noting returned value in parent), , in child, exec() command. in parent, have pid, , can use (e.g. in waitpid()).


Comments

Popular posts from this blog

Receive udp packets in android gstreamer -

php - Extract Text from HTTP referer -

java - Callback from new thread to class from which thread was initiated -