C# 将textbox的内容用文件流写入txt格式文本文档 编码为GB2312
System.IO.StreamWriterswobj=newSystem.IO.StreamWriter("C:\\1.txt",false,Encoding.GetE...
System.IO.StreamWriter swobj = new System.IO.StreamWriter("C:\\1.txt", false,Encoding.GetEncoding("GB2312"));
swobj.WriteLine(this.textBox1.Text);
swobj.Flush();
swobj.Close();
//上述方法无效,生成编码为ANSI的文档
FileStream nFile = new FileStream("C:\\1.txt", FileMode.CreateNew);
StreamWriter srd = new StreamWriter(nFile, Encoding.GetEncoding("gb2312"));//此方法也没有用 展开
swobj.WriteLine(this.textBox1.Text);
swobj.Flush();
swobj.Close();
//上述方法无效,生成编码为ANSI的文档
FileStream nFile = new FileStream("C:\\1.txt", FileMode.CreateNew);
StreamWriter srd = new StreamWriter(nFile, Encoding.GetEncoding("gb2312"));//此方法也没有用 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询