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);
精彩评论