forkexec1 - (char)0 perror"exec two failed" exit(1...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// forkexec1.cpp #include <stdio.h> #include <unistd.h> #include <stdlib.h> # int main() { if (fork() == 0) { execl("/bin/echo", "echo", "Printing", "from one", (char *)0); perror("exec one failed"); exit(1); } if (fork() == 0) { execl("/bin/echo", "echo", "Printing", "from two",
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (char *)0); perror("exec two failed"); exit(1); } if (fork() == 0) { execl("/bin/echo", "echo", "Printing", "from three", (char *)0); perror("exec three failed"); exit (3); } printf ("parent program ending.\n"); }...
View Full Document

This note was uploaded on 04/11/2010 for the course CECS 326 taught by Professor Staff during the Spring '08 term at CSU Long Beach.

Ask a homework question - tutors are online