try
{
fs = new FileStream(Program.VIDEOPATH + "progress.log", FileMode.Create, FileAccess.Write, FileShare.ReadWrite);
byte[] bts = ASCIIEncoding.ASCII.GetBytes(DateTime.Now.Ticks.ToString()); fs.Write(bts, 0, bts.Length);
fs.Flush(); }
catch (Exception e)
{
LoggerNS.Logger.writeToLog("Write process exception:"+e.Message);
}
finally
{
fs.Close();
// fs.Dispose();
}总是出现错误The process cannot acccess the file 'c:\VideoFolder\progress.log' because it is being used by another process.
不知道是哪里的问题,又没有开别的程序,而且这是个单线程的程序,而且又用了try catch。为什么这么奇怪呢?
{
fs = new FileStream(Program.VIDEOPATH + "progress.log", FileMode.Create, FileAccess.Write, FileShare.ReadWrite);
byte[] bts = ASCIIEncoding.ASCII.GetBytes(DateTime.Now.Ticks.ToString()); fs.Write(bts, 0, bts.Length);
fs.Flush(); }
catch (Exception e)
{
LoggerNS.Logger.writeToLog("Write process exception:"+e.Message);
}
finally
{
fs.Close();
// fs.Dispose();
}总是出现错误The process cannot acccess the file 'c:\VideoFolder\progress.log' because it is being used by another process.
不知道是哪里的问题,又没有开别的程序,而且这是个单线程的程序,而且又用了try catch。为什么这么奇怪呢?
还有个前提是文件不是隐藏的,是不是系统有什么问题把progress.log设置为隐藏