发布文件 [英] releasing a file

查看:54
本文介绍了发布文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的文件出现问题

我正在检查文件是否存在,如果存在,那么我想打开一个streamwriter

但是写流给我一个运行时错误,告诉我该文件已被其他进程使用?

hi guys i am experiencing a problem with my file

i am checking if a file exist and if it exists then i want a streamwriter open

but the stream writing gives me a runtime error telling me the file is used by a other process?

if (File.Exists(@"D:\Installs\Watchdog\Watchdog.log")){
sw = new System.IO.StreamWriter(@"D:\Installs\Watchdog\Watchdog.log", true);}



这是我的代码,请帮助我

我将文件存在,然后正常工作,但是如何检查文件是否存在?



this is my code please help me

i romove the file exists then it works fine but how do i check then if the file exists?

推荐答案

好吧,我想您的文件正在被另一个进程使用.是你的吗 ?我想是这样.如果删除File.Exists并且它起作用,则File.Exists必须是锁,但我对此表示怀疑.
Well, I guess your file is in use by another process. Is it yours ? I''d assume so. If you remove the File.Exists and it works, then File.Exists must be the lock, but I doubt it.


这篇关于发布文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆