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

📄 program5.c

📁 内含6个Linux平台下的程序
💻 C
字号:
/*#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>

main()
{
int fd;
int n;
int fdnum;
char buf[256];
mknod("fifo",S_IFIFO|0666,0);
fd = open("fifo",O_WRONLY);
fdnum = open("mywork",O_RDONLY);
//while((n=read(fdnum,buf,256))>0)
while(gets(buf)!=NULL)
{
write(fd,buf,256);
}
close(fd);
}*/




















#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>

main()
{
int fd;
char buf[256];
mknod("fifo",S_IFIFO|0666,0);
fd = open("fifo",O_WRONLY);
while(gets(buf)!=NULL)
{
write(fd,buf,strlen(buf)+1);
}
close(fd);
}

⌨️ 快捷键说明

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