Wite and Read to same file ERROR ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using StreamWriter to write to file and at the same time I'm using the
StreamReader to read from the same file.
Doing that cause an exception when I'm trying to create the StreamReader
when the file is already opened fro writing by the StreamWriter.

How can I write and read at the same time to the same file?
 
Thats because StreamReader already opens the File as Read&Write exclusive
(although is can only read from the file, I posted this as bug to MS but
they said they won't solve it for some reason I don't understand).
You have to use another method for opening the file for example File.Open so
you can read&write.
 
Back
Top