📄 fifo02.c
字号:
/***********
// name : fifo02.c
// author : pyy
// date : 2007-11-23
***************/
#include<sys/types.h>
#include<sys/stat.h>
#include<errno.h>
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<limits.h>
#include<fcntl.h>
int main( void )
{
int fd;
int len;
char buf[PIPE_BUF];
/* 打开名为test 的 FIFO */
fd = open("test",O_RDONLY);
if(fd < 0) {perror("open error"); exit(1);}
/* 读取 FIFO 存入buf变量中 */
while((len = read(fd, buf ,PIPE_BUF-1))>0) printf("%s",buf);
close(fd);
exit(0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -