dup2
Linux 使用 dup2 无法正常重定向管道 tinyhttpd
项目地址:https://github.com/pphboy/pihttpd 文件 p_sys.c tinyhttpd是这样写的 ![image](https://img2023.cnblogs.com/blog/2146100/202307/2146100-20230709102422502-13 ......
dup2 and dup修改和恢复进程的标准输入
`dup2(oldfd, newfd)`. 旧的文件描述符,和新的文件描述符指向同一个文件。 `int ans = dup(oldfd);` 返回值文件描述符和旧的文件描述符指向同一个文件。 通过dup/dup2,可以将多个文件描述符指向同一个文件实体,它们都可以等效得访问同一个文件。 dup2的操 ......