procread.c

来自「此源码是著名的教材BeginningLinux Programming中文名字叫」· C语言 代码 · 共 23 行

C
23
字号
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/types.h>

#define FIFO_NAME  	"myfifo"
#define BUF_SIZE    	1024

int main(void)
{
        int     fd;
        char    buf[BUF_SIZE];

        umask (0);
        fd = open(FIFO_NAME, O_RDONLY);
        read (fd, buf, BUF_SIZE);
        printf ("Read content: %s\n", buf);
        close (fd);
        exit (0);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?