c41f1de5d4
pipes
21 lines
257 B
C
21 lines
257 B
C
char buf[32];
|
|
|
|
main()
|
|
{
|
|
int pid, fds[2], n;
|
|
|
|
pipe(fds);
|
|
pid = fork();
|
|
if(pid > 0){
|
|
write(fds[1], "xyz", 4);
|
|
puts("w");
|
|
} else {
|
|
n = read(fds[0], buf, sizeof(buf));
|
|
puts("r: ");
|
|
puts(buf);
|
|
puts("\n");
|
|
}
|
|
while(1)
|
|
;
|
|
}
|