⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fi1.c

📁 Linux大学上机源码学习
💻 C
字号:
#include <stdio.h>#include <stdlib.h>#include <fcntl.h>#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>#define FIFO_FILE "myfifo"int main(){ int fifo_fd,n,total_byte=0;  char readbuf[4096+1];  mkfifo(FIFO_FILE,0666);  fifo_fd=open(FIFO_FILE,O_RDONLY);  while((n=read(fifo_fd,readbuf,4096))>0){     printf("%d received %d bype\n",getpid(),n);     total_byte+=n;  }  close(fifo_fd);  printf("Process %d received %d bytes then finished\n",getpid(),total_byte);  return 0;}

⌨️ 快捷键说明

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