#include #include #include main() { char *s, buf[1024]; int fds[2], i; s = "hello world\n"; pipe(fds); if (fork() == 0) { write(fds[1], s, 12); printf("child process: \n"); exit(0); } i = read(fds[0], buf, 6); buf[i] = '\0'; printf("parent process: i = %d\n", i); write(1, buf, 6); } /* example2.c */ /* IPC can be used to enforce the order */