I have the following problem:
I use this code to open a file and write to it:
using (FileStream fileStream = new FileStream(saveDir + @"\" + saveFile, FileMode.Open, FileAccess.ReadWrite,FileShare.ReadWrite))
{
StreamWriter streamWriter = new StreamWriter(fileStream);
streamWriter.Write("Test");
streamWriter.Close();
}
but in the "using" line it tells me that it can not open the file because it is used by another process but the file is not open and isn't used. What's wrong? I searched around this forum and the internet but I can't find a solution.