pipe

作者: 之江狂徒 | 来源:发表于2018-12-13 22:10 被阅读0次

//pipe.c

#include <stdio.h>

#include <unistd.h>

int main(int argc, char **argv)

{

int fd[2];

pid_t pid;

char buf[20]={0};

int len = 0;

if(pipe(fd) < 0)

printf("Create Pipe Error!\n");

if((pid = fork()) < 0) {

printf("Fork Error!\n");

} else if(pid > 0) {

close(fd[0]);

write(fd[1],"hello world\n", 12);

} else {

close(fd[1]);

read(fd[0], buf, 20);

printf("%s\n", buf);

}

//pause();

return 0;

}

相关文章

  • 聊聊storagetapper的pipe

    序 本文主要研究一下storagetapper的pipe Pipe storagetapper/pipe/pipe...

  • NIO十二-Pipe

    Java NIO Pipe Creating a Pipe Writing to a Pipe Reading f...

  • Angular Pipe

    Angular Pipe is object, not function, when pipe created, ...

  • python 学习笔记(Queue & Pipe 进程间的通讯)

    Pipe multiprocessing.Pipe()即管道模式,调用Pipe()返回管道的两端的Connecti...

  • 自定义pipe

    自定义pipe pipe说明:(自定义pipe只需实现 PipeTransform接口的transform方法即可 )

  • Linux IPC

    Pipe Named Pipe Signal Semaphore Message Queue Memory Sha...

  • Linux IPC

    Pipe/FIFO(named Pipe)/Semaphore/Message Queue/Share Memor...

  • 管道

    man 7 PIPE pipe和FIFO介绍pipe匿名管道,只能用于有亲缘关系的进程间通信FIFO命名管道,任意...

  • Android进程间通信机制-管道

    PIPE和FIFO的使用及原理 PIPE和FIFO都是指管道,只是PIPE独指匿名管道,FIFO独指有名管道,我们...

  • ng2 内置pipe 一览

    ng2 内置pipe 一览 pipe说明: UpperCasePipe --- Transforms text ...

网友评论

      本文标题:pipe

      本文链接:https://www.haomeiwen.com/subject/lssihqtx.html