Technically, you can do what you need to do using fork() and the exec family.
It can work as follows:
pid_t PID = fork(); if(PID == 0) { execl("yourcommandhere"); exit(1); }
execl (or any other family member, see here: http://linux.die.net/man/3/execl ), replaces the current process with the process you are calling. This is a child process that we created with fork. Fork returns "0" for the child process and the actual process identifier for the child process in the original process, calling fork, which gives the original process control.
By calling kill and supplying SIGINT (15), you tell the process with the specified PID (which you got from fork) to stop. exit(1) necessary, because otherwise, if execl should fail, you will have two processes doing the same in your hands. It is faultless.
Hope this helps.
source share