How to check if a file is already open by another process in C?

前端 未结 8 520
感情败类
感情败类 2020-12-03 15:08

I see that standard C has no way of telling if a file is already opened in another process. So the answer should contain several examples for each platform. I need that chec

8条回答
  •  广开言路
    2020-12-03 15:27

    Any such check would be inherently racy. Another process could always open the file between the point where you did the check and the point where you accessed the file.

提交回复
热议问题