输出结果无法显示汉字是为什么都是??????
我读取文件class StreamReadWrite
{
public void ReadFile()
{
FileStream fs = new FileStream(@"C:\TXTDAY.txt", FileMode.Open, FileAccess.Read, FileShare.Read);
StreamReader sr = new StreamReader(fs);
sr.BaseStream.Seek(0, SeekOrigin.Begin);
string str = sr.ReadLine();
while (str != null)
{
Console.WriteLine(str);
str = sr.ReadLine();
}
sr.Close();
fs.Close();
}
public void WriteFile()
{
FileStream fs = new FileStream(@"C:\TXTDAY.txt", FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
Console.WriteLine("请输入一个字符串");
string str = Console.ReadLine();
sw.WriteLine();
sw.WriteLine(str);
sw.Flush();
sw.Close();
fs.Close();
}
}
汉字文件都是?????