开发者

dup2 to redirect stdout and stderr to another file descriptor

i have a call like this.

int fd[2];
pipe(fd)
开发者_StackOverflow

and then

dup2(fd[WRITE],STDOUT_FILENO)

is there a way to use the dup call to duplicate both 1 and 2 to fd[WRITE]?


Just repeat this operation for stderr.

dup2(fd[WRITE], STDOUT_FILENO);
dup2(fd[WRITE], STDERR_FILENO);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜