我写了一个读取其他程序产生的日志文件XXX.LOG文件的小程序,使用了FileStream方法来打开文件,但是发生错误,提示为:because it is being used by another process。应该是文件被那个程序独占的方式打开了,后来我修改FileStream的参数为只读(FileStream(path1, FileMode.Open, FileAccess.Read, FileShare.Read)),但是还是同样提示,用windows记事本程序是可以打开的,请问应该怎么解决这个问题呀???
Dim fs As New FileStream(path1, FileMode.Open, FileAccess.Read, FileShare.Read)
Dim sr As New StreamReader(fs, System.Text.Encoding.GetEncoding("Gb2312"))