rfifo.c
来自「Linux网络编程FIFO源码。wfifo.c创建并打开文件」· C语言 代码 · 共 38 行
C
38 行
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int fd;
char buff[4];
fd = open("test_fifo", O_RDONLY);
if(fd < 0){
printf("open error\n");
exit(1);
}
while(1){
if(read(fd, buff, sizeof(buff)) < 0){
printf("read error\n");
}else{
printf("read str == [%s]\n", buff);
}
}
close(fd);
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?