Linux下由两个管道提供双向数据流的C程序
2008年11月12日 12:44
标签: c语言, Develop and Freebsd/Unix服务器
以下是一个Linux/Unix下由两个管道提供双向数据流的C程序,这是操作系统课程中经常使用的基本程序:
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <string.h>
int main()
{
int fd1[2],fd2[2],cld_pid,status;
char buf[200], len;
if (pipe(fd1) == -1) // 创建...