Chinaunix首页 | 论坛 | 博客
  • 博客访问: 437607
  • 博文数量: 113
  • 博客积分: 446
  • 博客等级: 下士
  • 技术积分: 1229
  • 用 户 组: 普通用户
  • 注册时间: 2012-12-09 16:01
个人简介

Let's go!!!!!

文章分类

全部博文(113)

文章存档

2019年(5)

2018年(4)

2017年(9)

2016年(5)

2015年(39)

2014年(6)

2013年(28)

2012年(17)

发布时间:2012-12-09 16:30:36

FILE *popen ( char *command, char *type)popen()函数首先调用pipe()函数建立一个管道,然后它用fork()函数建立一个子进程,运行一个shell 环境,然后在这个shell 环境中运行"command"参数指定的程序。数据在管道中流向由"type"参数控制。这个参数可以是"r"或者"w",分别代表读和写。需要注意的是,"r"和"w"两个参数不能同时使用!注意:管道是在 pclose() 的时候执行 popen() 创建的脚本命令!!!#include <stdio.h>#include<stdlib.h>#include......【阅读全文】

阅读(880) | 评论(0) | 转发(0)

发布时间:2012-12-09 16:13:21

int pipe(int fd[2])管道通信为半双工通信,用于父子进程之间。管道创建成功返回0,出错返回-1.fd[0]为读打开,fd[1]为写打开。   #include<unistd.h>#include<string.h>#include<sys/types.h>#include<errno.h>#include<stdio.h>#include<stdlib.h>main(){ int pipe_fd[2]; pid_t pid; char r_buf[25];&nbs......【阅读全文】

阅读(660) | 评论(0) | 转发(0)
给主人留下些什么吧!~~
留言热议
请登录后留言。

登录 注册