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 -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -