#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h> #define MYFIFO "/tmp/myfifo" int main(int argc, char *argv[])
{
int fd;
char buf_w[]; fd=open(MYFIFO,O_WRONLY|O_NONBLOCK,);
if(fd==-)
{
printf("Open the FIFO is fail!\n");
if(errno==ENXIO)
printf("There is no Read FIFO!\n");
exit();
}
memset(buf_w,,sizeof(buf_w));
strcpy(buf_w,argv[]);
if(write(fd,buf_w,)<)
{
printf("Write data to FIFO fail!\n");
}
else
{
printf("Write data are: %s\n",buf_w);
} return ;
}
相关文章
- Python3 File flush() 方法、 Python3 File write() 方法
- MySQL_写锁_lock tables tableName write
- open函数 write函数 以及 read函数 文件描述符
- Ubuntu 12.04 64bit 配置完android 5.0编译环境后出现“could not write bytes: Broken pipe.”而无法进入输入帐号密码的登陆界面
- redis报错:java.net.SocketException: Broken pipe (Write failed); nested exception is redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Broken pipe (Write failed)
- 读取缓存模拟----FIFO
- 嵌入式linux文件I/O编程 (open、read、write、lseek、close
- 嵌入式linux文件I/O编程 (open、read、write、lseek、close)
- 解决ssh的"Write failed: Broken pipe"问题
- STL队列 之FIFO队列(queue)、优先队列(priority_queue)、双端队列(deque)