blob: bbe6f5b673abbcea3220db7679b5494258b76478 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "user.h"
char buf[32];
int
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");
}
for(;;);
}
|