#include <stdio.h>
#define MSGSIZE 16

int main(void) {
	char *msg1 = "hello world #1";
	char inbuf[MSGSIZE];

	int p[2];

	int pid;
	pipe(p);

	if ((pid = fork()) == 0) { /* child process */
		read(p[0], inbuf, MSGSIZE);
		printf("msg = %s\n", inbuf);
		close(p[0]);
	}

	else { /* parent process */
		write(p[1], msg1, MSGSIZE);
		close(p[1]);
	}
	exit(0);
}
