pipe管道
来源:互联网 发布:卖家如何联系淘宝小二 编辑:程序博客网 时间:2024/05/16 06:44
#include <stdio.h>#include <string.h>#include <unistd.h>#include <sys/types.h>#define K 1024int main(void){ int result = -1; int fd[2], nbytes; pid_t pid; char string[ ] = "hello, pipe"; char readbuffer[K]; int *write_fd = &fd[1]; int *read_fd = &fd[0]; result = pipe(fd); if (result == -1) { printf("build pipe failed.\n"); return -1; } pid = fork(); if (pid == -1) { printf("fork progess failed.\n"); return -1; } if (pid == 0) { close(*read_fd); result = write(*write_fd, string, strlen(string)); return 0; } else { close(*write_fd); nbytes = read(*read_fd, readbuffer, sizeof(readbuffer)); printf("recv: %d bytes, data: %s\n", nbytes, readbuffer); } return 0;}
0 0
- 管道pipe
- 管道 pipe
- 管道(pipe)
- 管道-pipe
- pipe管道
- pipe 管道
- pipe管道
- pipe管道
- pipe管道
- 管道 PIPE
- 管道pipe
- 管道(pipe)
- 管道(pipe)
- pipe管道
- 管道pipe
- 消息管道(Message Pipe)
- 管道(Pipe)/createPipe
- cpp 管道 pipe
- HDOJ 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活 2191
- Java_语法基础_不要让类型默默转换
- 第23章 MYSQL结构
- 基于人工分析的HTTP-POST请求报文特征获取一般方法
- LeetCode Valid Sudoku
- pipe管道
- zoj 2949 Coins of Luck 抛硬币(概率(期望)+dp)
- 嵌入式开发第一课(嵌入式开发整体流程及开发环境的搭建)
- PAT BASIC PRACTISE: 1001. 害死人不偿命的(3n+1)猜想
- mybatis中的#和$的区别
- 程序员初见Maya 之 简单骨骼蒙皮动画
- 【翻译自mos文章】使用Process Monitor 来跟踪windows下的系统调用(system calls)
- Android 动画之RotateAnimation应用详解
- Maven项目里的pom解析和nexus私服