开发者

How can I write to a file that is in use by another process in C#?

开发者 https://www.devze.com 2023-02-01 07:37 出处:网络
How can I write to a file which is used by another process in C#? I am able to read the file using FileShare.ReadWrite, but it only works for FileAccess.Re开发者_Go百科ad. Does anyone have a solution

How can I write to a file which is used by another process in C#?

I am able to read the file using FileShare.ReadWrite, but it only works for FileAccess.Re开发者_Go百科ad. Does anyone have a solution?


If the other process has write-locked the file, then there's not much you can do, unless you don't mind closing the other process's handle or killing it.


You should read the file contents to a separate Stream and then the file is released.

0

精彩评论

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

关注公众号