You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
381 B

#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
int main(int argc, char const *argv[])
{
int p=fork();
if(p==0){
execl("./process1",NULL,NULL);
printf("Exec() is error.\n");
exit(1);
}else if(p>0){
waitpid(p,NULL,0);
printf("child: %d.\n",p);
}else{
printf("Failed to create child.\n");
exit(1);
}
return 0;
}