pipe
来源:互联网 发布:证件照ps软件 编辑:程序博客网 时间:2024/05/29 09:41
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
int main()
{
int fd,fp,fp1;
char buf[100]={0};
int res = mkfifo("data",0777);
if(res == 0)
{
printf("FIFO created!\n");
}
else
{
perror("fifo error\n");
}
fp = fork();
if(fp<0)
{
perror("fork error");
exit(1);
}
if(0 == fp)
{
fd = open("data",O_WRONLY);
if(fd == -1)
{
perror("open error");
exit(1);
}
else
{
write(fd,"hello",sizeof("hello"));
printf("open success\n");
}
exit(0);
}
}
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
int main()
{
int fd,fp,fp1;
char buf[100]={0};
int res = mkfifo("data",0777);
if(res == 0)
{
printf("FIFO created!\n");
}
else
{
perror("fifo error\n");
}
fp = fork();
if(fp<0)
{
perror("fork error");
exit(1);
}
if(0 == fp)
{
fd = open("data",O_WRONLY);
if(fd == -1)
{
perror("open error");
exit(1);
}
else
{
write(fd,"hello",sizeof("hello"));
printf("open success\n");
}
exit(0);
}
}
- pipe()
- pipe
- pipe
- pipe
- pipe
- PIPE
- pipe
- pipe
- pipe
- pipe
- pipe
- pipe
- pipe
- pipe()
- Pipe
- pipe
- pipe
- PIPE
- NeHe+OpenGL教程 第七课 纹理过滤器、光照和键盘控制
- 变量的命名方法【Hungarian】【camelCase】【PascalCase】
- 备份 读Win32 平台上用户级进程(某线程,其实就是本线程)的各段寄存器的值,并解析其指向的段的信息
- 【Java练习9】POJ 2389
- Android ImageView 加边框
- pipe
- linux上配置ssh的无密码登录
- Effective c++ 条款16学习笔记: 成对使用new和delete时要采取相同形式
- 博客开发日记0923
- 【黑马程序员】张孝祥Java高新技术_类加载器、代理
- 数据库的范式理论
- 程序员要知道的
- 一位IT人士的个人经历,送给迷茫中的朋友们
- IIS6 图解