Programming and posix - April 2002

April 3, 2002
Solution Symposium
Page 42
hp e3000
programming
and posix
process management - exec()
6 forms: execl(), execve(), execvp(), execv(), execve(),
execvp()
replaces the current process with a newly spawned one
if ( (pid = fork()) < 0)
perrror("fork");
else if (pid == 0) /* child */
{
if (execl("/bin/echo",
"echo", "child:", "hello",
"world", (char *) 0) < 0)
perror("execl");
printf("child: this never prints\n");
}