#include #include #include #include main(){ int pid, status, died, fd; fd = creat("sharedfile", 0644); if(fd == -1){ fprintf(stderr,"cannot create sharedfile\n"); exit(2); } switch(pid = fork()){ case -1: fprintf(stderr,"Can't fork\n"); exit(1); case 0: /* child process */ write(fd, "CCCC", 4); close(fd); exit(0); default: /* parent process */ write(fd,"PPPP",4); close(fd); died = wait(&status); } exit(0); }