fifopro.c

来自「word count information using message que」· C语言 代码 · 共 38 行

C
38
字号
#include<stdio.h>#include<sys/types.h>#include<sys/stat.h>#include<fcntl.h>#include<unistd.h>#include<stdlib.h>#include<string.h>int main(){char msg[100];int fd;int ch=1;mknod("genfifos",S_IFIFO | 0666,0);// 	{// 	printf("eroor in fifo creation");            //error will be ter if same name is used fo the pipe// 	}// else// 	{// 	printf("good\n");// 	}fd=open("genfifos", O_WRONLY );if(fd==-1)	{	printf("error in opening");	}printf("run fifo.c and then ");while(ch){printf("enter the message \n");fgets(msg,sizeof(msg),stdin);write(fd,msg,sizeof(msg));//printf("do u want to continue yes -1 ==no -0  \n");}close(fd);	return 0;}

⌨️ 快捷键说明

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