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

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -