📄 管道.txt
字号:
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<limits.h>
main(void)
int,fd,len;
char buf[pipe_buf];
mode_t mode=0660;
if(myfifo("fifo1",mode)<0)
{
printf("myfifo err\n");
exit(1);
}
if((fd=open("fifo1",o_rdonly))<0)
{
printf("pipe open err\n");
exit(1);
}
while(len=(read(fd,buf,pipe_buf-1))>0)
printf("read fifo pipe:%s",buf);
close(fd);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -