[clug-talk] Call a program in C and get the child PID?

Roy Souther roy at silicontao.com
Mon Sep 19 09:31:38 PDT 2005


Does anyone know how to call a child program in C and get the PID? 

The system command only returns the exit code, fork copies the running
program and the many version of exec terminate the original program. 

I want to spawn the called program, keep it running and get the PID
back. I want my C program to start a shell in xterm and then be able to
go and do other things and watch for the xterm shell to be closed by the
user.

go_do("xterm &");
ChildPid = SomeHowGetTheChildPid();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : /pipermail/clug-talk_clug.ca/attachments/20050919/8a454aed/attachment-0001.bin


More information about the clug-talk mailing list