[clug-talk] Call a program in C and get the child PID?
Robert Lewko
lewkor at telus.net
Mon Sep 19 11:13:19 PDT 2005
On September 19, 2005 10:31 am, Roy Souther wrote:
> 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();
Sorry that first reference should have read:
Advanced Programming in the UNIX Environment. Richard Stevens, Addison
Wesley.
More information about the clug-talk
mailing list