Duplicate file descriptor with its own file offset

前端 未结 3 1565
醉话见心
醉话见心 2021-02-05 13:20

How can one create a new file descriptor from an existing file descriptor such that the new descriptor does not share the same internal file structure/entry in the file table? S

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-05 13:48

    Why don't you just open the file a second time with open() or CreateFile() on windows? This gives you all freedom of different access rights and separate offset.

    This of course has the drawback that you you can not open the file exclusively, but it solves your problem very simply.

提交回复
热议问题