它很可能与文件共享语义有关 . 见this thread处理类似的问题 - 答案是"The concept of file protection, file sharing, file permissions is OS-specific, which is why it is not covered by standard C++" .
1
我想知道,在某个地方,引擎盖下, std::fstream 版本是否正在调用 open - 我敢打赌 . 您是否尝试过检查errno,或者运行 strace 以查看系统调用返回的是什么错误?
2 回答
它很可能与文件共享语义有关 . 见this thread处理类似的问题 - 答案是"The concept of file protection, file sharing, file permissions is OS-specific, which is why it is not covered by standard C++" .
我想知道,在某个地方,引擎盖下,
std::fstream
版本是否正在调用open
- 我敢打赌 . 您是否尝试过检查errno,或者运行strace
以查看系统调用返回的是什么错误?