In the following code I get the error "stream was not writable":
class Class1
{
private static void Main()
{
FileStream fs = new FileStream("C:\fFile.txt",
FileMode.OpenOrCreate,
FileAccess.ReadWrite,
FileShare.ReadWrite);
StreamReader r = new StreamReader(fs);
string t = r.ReadLine();
r.Close();
Console.WriteLine(t);
StreamWriter w = new StreamWriter(fs);
w.WriteLine("string");
w.Flush();
w.Close();
fs.Close();
}
}
这一错误出现在<代码>上。 页: 1
为什么如此?