FIFO管道写规则
来源:互联网 发布:苹果mac好用吗 编辑:程序博客网 时间:2024/05/21 09:30
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FIFO_SERVER "/tmp/myfifo"
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FIFO_SERVER "/tmp/myfifo"
main(int argc,char** argv)
{
int fd;
char w_buf[100];
int nwrite;
/*打开管道*/
fd=open(FIFO_SERVER,O_WRONLY|O_NONBLOCK,0);
if(argc==1)
{
printf("Please send something\n");
exit(-1);
}
strcpy(w_buf,argv[1]);
/* 向管道写入数据 */
if((nwrite=write(fd,w_buf,100))==-1)
{
if(errno==EAGAIN)
printf("The FIFO has not been read yet.Please try later\n");
}
else
printf("write %s to the FIFO\n",w_buf);
}
{
int fd;
char w_buf[100];
int nwrite;
/*打开管道*/
fd=open(FIFO_SERVER,O_WRONLY|O_NONBLOCK,0);
if(argc==1)
{
printf("Please send something\n");
exit(-1);
}
strcpy(w_buf,argv[1]);
/* 向管道写入数据 */
if((nwrite=write(fd,w_buf,100))==-1)
{
if(errno==EAGAIN)
printf("The FIFO has not been read yet.Please try later\n");
}
else
printf("write %s to the FIFO\n",w_buf);
}
0 0
- FIFO管道写规则
- Linux命名管道FIFO的读写规则
- Linux命名管道FIFO的读写规则
- Linux命名管道FIFO的读写规则
- Linux命名管道FIFO的读写规则
- FIFO管道
- 管道-fifo
- 管道,fifo
- 二十一、Linux系统编程-管道(二)命名管道(FIFO)、匿名管道与命名管道区别、命名管道的打开规则
- FIFO 有名管道
- 管道和FIFO
- 有名管道FIFO实例
- FIFO 有名管道
- 管道,FIFO的实现
- IPC ------有名管道fifo
- linux 有名管道FIFO
- linux fifo 有名管道
- 有名管道FIFO
- hive 三种启动方式及用途
- 使用Python分析谷歌浏览器Chrome的历史记录
- android中的内部存储与外部存储
- 【Qt开发】 QT:make: Nothing to be done for `first'和error:QtSql:No such file or directory
- 2016年下半年规划
- FIFO管道写规则
- Fedora安装Hadoop
- 作业七-ID-1052-Problem D: Sequence Problem (III) : Array Practice
- 零基础PS----制作动态图片GIF
- HTTPS 互联网世界的安全基础
- appserv phpmyadimin登陆mysql提示1045 access denied for user 'root'@'localhost' using password yes
- Android遇到问题应该怎么解决
- 集合类总结笔记
- 以每行一个单词的形式打印其输入