2006-06-27 14:35:53 +00:00
|
|
|
char buf[32];
|
2006-06-26 15:11:19 +00:00
|
|
|
|
2006-06-22 20:47:23 +00:00
|
|
|
main()
|
|
|
|
{
|
2006-06-27 14:35:53 +00:00
|
|
|
int pid, fds[2], n;
|
|
|
|
|
|
|
|
pipe(fds);
|
2006-06-26 20:31:52 +00:00
|
|
|
pid = fork();
|
2006-06-27 14:35:53 +00:00
|
|
|
if(pid > 0){
|
|
|
|
write(fds[1], "xyz", 4);
|
|
|
|
puts("w");
|
2006-06-26 20:31:52 +00:00
|
|
|
} else {
|
2006-06-27 14:35:53 +00:00
|
|
|
n = read(fds[0], buf, sizeof(buf));
|
|
|
|
puts("r: ");
|
|
|
|
puts(buf);
|
|
|
|
puts("\n");
|
2006-06-26 20:31:52 +00:00
|
|
|
}
|
2006-06-22 20:47:23 +00:00
|
|
|
while(1)
|
|
|
|
;
|
|
|
|
}
|