4
dup2 / dup-为什么我需要复制一个文件描述符?
我想了解使用dup2和dup。 从手册页: DESCRIPTION dup and dup2 create a copy of the file descriptor oldfd. After successful return of dup or dup2, the old and new descriptors may be used interchangeably. They share locks, file position pointers and flags; for example, if the file position is modified by using lseek on …