fi2.c

来自「Linux大学上机源码学习」· C语言 代码 · 共 22 行

C
22
字号
#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,i=0,n,total_byte=0;  char sendbuf[4096+1];  fifo_fd=open(FIFO_FILE,O_WRONLY);  while(i<4){     n=write(fifo_fd,sendbuf,4096);     printf("%d write %d bype\n",getpid(),n);     total_byte+=n;     i++;  }  close(fifo_fd);  printf("Process %d  finished\n",getpid());  return 0;}

⌨️ 快捷键说明

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