相关疑难解决方法(0)

dup2/dup - 为什么我需要复制文件描述符?

我想了解使用dup2dup.

从手册页:

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
one of the descriptors, the position is also changed for the other.

The two descriptors do not share the close-on-exec flag, however.

dup uses the lowest-numbered …
Run Code Online (Sandbox Code Playgroud)

c linux operating-system system-calls

79
推荐指数
2
解决办法
4万
查看次数

标签 统计

c ×1

linux ×1

operating-system ×1

system-calls ×1