开发者

Handling File Access when a file is in use

Since there's no way to reliably check if a file is in use before trying to access it, i开发者_StackOverflows it advisable to just make continuous attempts at moving/deleting/reading them until the action is succesful?


Hope this one helps... [it is in C#... and not the most elegant way of doing this, but still check it out] http://www.dotnetscraps.com/dotnetscraps/post/FileInUse.aspx


It depends on the language/operating system you're using. Most languages have some sort of method to check if file is available for opening; another thing you can do is to try to open the file and catch the exception if it is open. Finally, if you're solely intending to read from a file, you may be able to open it anyway.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜