#include #include #include int main() { pid_t pid; /* fork another process */ pid = fork(); if (pid < 0) { /* error occurred */ fprintf(stderr, "Fork Failed"); return(1); } else if (pid == 0) { /* child process */ fprintf(stderr, "\n In child process \n"); execlp("/bin/ls", "ls", NULL); } else { /* parent process */ /* parent will wait for the child to complete */ wait (NULL); fprintf(stderr, " Child Complete\n"); } return 0; }