23,121
社区成员
发帖
与我相关
我的任务
分享
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>
#include<stdio.h>
#include<fcntl.h>
#include<string.h>
int main(){
if(mkfifo("testfifo",O_CREAT|O_RDWR) == -1)
{
perror("mkfifo");
return 0;
}
int fd;
if((fd=open("testfifo",O_WRONLY,0100)) == -1){
perror("open");
return 0;
}
char buf[]="test data.........";
int len=strlen(buf);
if(write(fd,buf,len) == -1){
perror("write");
return 0;
}
return 0;
}