My code is:
StreamReader r = new StreamReader("temp.txt");
string str = r.ReadLine();
Console.WriteLine(str);
StreamWriter w = new StreamWriter("temp.txt");
w.WriteLine("new text");
str = r.ReadLine();
Console.WriteLine(str);
When I run it, it throws an unhandled exception and cannot access the file. Iām sure the path of the file is correct and it is not write-protected.