File Create and then cannot StreamReader
When my app start it checks if certain file in a certain directory exist and if they don't exist creates them.
Later my app tries to read from that file but an exception is thrown:
System.IO.IOException: The process cannot access the file 'c:\test\a.txt' because it is being used by another process. and it goes on and on with this message.
I have written a small test program to show what I do and what is my problem.
What I am doing wrong? Please.
if (System.IO.Directory.Exists("c://test") == false)
if (System.IO.File.Exists("c://test") == false)
using (System.IO.StreamReader sr = System.IO.File.OpenText("c://test//a.txt"))
catch (Exception e)