C#通过流写入一行数据到文件
using System; using System.IO; public class WriteFileStuff { public static void Main() { FileStream fs = new FileStream("c:\\tmp\\WriteFileStuff.txt", FileMode.OpenOrCreate, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); try { sw.WriteLine("Howdy World."); } finally { if(sw != null) { sw.Close(); } } } }