//管道是半双工通信,通信两端一端写,一端读.
//在这里插入图片描述Makefile文件
#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/select.h>
#define args_check(argc,num) {if(argc!=num) {printf(“error args\n”);return -1;}}
//chat1
#include “fun.h”
int main(int argc ,char **argv)
{
args_check(argc,3);//因为要传2个管道,所以改成3
int fdr=open(argv[1],O_RDONLY);//以读的方式打开一号管道
if(fdr==-1)
{
perror(“open”);
return -1;
}
int fdw;//以写的方式打开2号管道
fdw=open(argv[2],O_WRONLY);//以写的方式打开二号管道
if(fdw==-1)
{
perror(“open1”);
return -1;