开发者

Open a locked file in exlusive mode

开发者 https://www.devze.com 2023-01-16 19:47 出处:网络
There is a file which is locked by another process for editing. Is th开发者_高级运维ere any way to open the file in exclusive mode using the C program?Yes, kill the other process.An OS otherwise of co

There is a file which is locked by another process for editing. Is th开发者_高级运维ere any way to open the file in exclusive mode using the C program?


Yes, kill the other process. An OS otherwise of course does not provide a way to allow you to open a locked file, that would utterly defeat the point of supporting locking.

Fwiw, a pretty common mistake is to try to open a file that another process has opened for writing and specifying only read sharing. Can't work, the other process already gained write access. You must specify read+write sharing.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号