Delete Practice_06/ipcPipe.c
This commit is contained in:
@@ -1,26 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
int main(){
|
|
||||||
pid_t pid;
|
|
||||||
int fd[2], n;
|
|
||||||
char buf[10];
|
|
||||||
|
|
||||||
pipe(fd);
|
|
||||||
pid = fork();
|
|
||||||
|
|
||||||
if(pid == 0){
|
|
||||||
close(fd[0]);
|
|
||||||
write(fd[1], "FOXLIVER", 9);
|
|
||||||
close(fd[1]);
|
|
||||||
}else{
|
|
||||||
close(fd[1]);
|
|
||||||
n = read(fd[0], buf, 10);
|
|
||||||
buf[n] = '\0';
|
|
||||||
printf("Parent receive : %s\n", buf);
|
|
||||||
close(fd[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user