使用管道系统提供了 pipe(
2)
#include <unistd.h>
int pipe(
int pipefd[
2]);
功能:创建一个管道,单向的
参数:
pipefd:用于返回管道的两端
[
0]:指向管道的读端
[
1]:指向管道的写端
返回值: 成功
0
失败 -
1 errno被设置
#include <unistd.h>
int fd[
2];
int pc = pipe(fd);
if(pc == -
1) {
perror(
"pipe");
return -
1;
}
转载请注明原文地址: https://www.6miu.com/read-14324.html