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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -