标签:
if (!Directory.Exists("F:\\TestTxt")) { Directory.CreateDirectory("F:\\TestTxt"); if (!File.Exists("F:\\TestTxt\\TestTxt.txt")) { FileStream fs1 = new FileStream("F:\\TestTxt\\TestTxt.txt", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs1); sw.WriteLine(this.textBox1.Text.Trim()); sw.Close(); fs1.Close(); } }
说明:创建文件TestTxt.txt。
<span style="font-size:14px;"> string sname = new string[500]; StreamReader sr = new StreamReader("</span>F:\\TestTxt\\TestTxt.txt<span style="font-size:14px;">",System.Text.Encoding.Default); while (!sr.EndOfStream) { sname[i] = sr.ReadLine(); i++; }</span>读取数据
标签:
原文地址:http://blog.csdn.net/ilipan/article/details/46285327