У меня есть открытый вордовский файл. Хочу считать с него данные. Пишу следующий логичный код :
const string FILE_NAME = "
c://temp//111.doc";
try
{
StreamReader sr = new StreamReader("
c://temp//111.doc");
}
catch(Exception e)
{
//System.Diagnostics.Debugger.Break();
Console.WriteLine(e.Message);
}
System.IO.IOException: The process cannot access the file "c:\temp\111.doc" beca
use it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFr
omProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detec
tEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path)
at ConsoleApplication1.Class1.Main(String[] args) in c:\inetpub\wwwroot\conso
leapplication1\class1.cs:line 20
Я бы решил что на этом все, однако аналогичный код в java с использованием InputStream работает нормально. Как мне решить эту проблему?
... << RSDN@Home 1.1.4 stable SR1 rev. 568>>