<分区>
我想在打开的文件上使用 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);
谢谢