gpt4 book ai didi

c++ - 如何从 std::ofstream 获取文件 ID

转载 作者:行者123 更新时间:2023-11-28 02:43:35 26 4
gpt4 key购买 nike

<分区>

我想在打开的文件上使用 flock(int fd, int operation),但是 flock()c 函数。如何从 std::ofstream outfile 获取 int fd 以用作 flock() 的参数。

附言。我想要 c++ 风格的 int fd,我知道我可以打开 c 风格的文件并获取它。问题是关于 c++ 和 flock()

std::ofstream outfile;
outfile.open ( LOCKFILE, std::ios_base::trunc);

谢谢

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com