Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这样的电话。
int fd[2]; pipe(fd)
接着
dup2(fd[WRITE],STDOUT_FILENO)
有没有办法使用 dup 调用将 1 和 2 复制到 fd[WRITE]?
只需对 stderr 重复此操作。
dup2(fd[WRITE], STDOUT_FILENO); dup2(fd[WRITE], STDERR_FILENO);