摘要: 1.可以在任意进程(不需要有关系)中进行通信; 2.管道本质是内核中的一块缓存; 3.FIFO在文件系统中存在一个管道文件,管道文件也是和内核中的缓存同步的,是指向文件的路径; 4.命令管道默认是阻塞型; 5.对FIFO的操作跟普通文件一样,可用open打开它,一般的文件I/O函数(close,re 阅读全文
posted @ 2017-03-06 20:16 lvdh1314 阅读(173) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <stdlib.h>#include <memory.h>int main(void){ FILE *fp; //命令执行的结果放置在fp指向的结构体缓冲中 fp = popen("cat /etc/passwd","r"); char buf[ 阅读全文
posted @ 2017-03-06 19:27 lvdh1314 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 管道(pipe)、命名管道(FIFO)、信号(signal)、消息队列、共享内存、信号量、套接字(socket) #include <unistd.h>#include <string.h>#include <stdlib.h>#include <stdio.h>/*父进程通过管道传输两个数据给子进 阅读全文
posted @ 2017-03-06 10:29 lvdh1314 阅读(139) 评论(0) 推荐(0) 编辑