FileStream构造函数
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.IO; 6 7 namespace IOtext 8 { 9 class Program 10 { 11 static void Main(string[] args) 12 { 13 //打开一个文件夹,并且将信息追加到文件夹末尾 14 FileStream fs = new FileStream("c:\\iotext.txt", FileMode.Append, FileAccess.Write, FileShare.Write); 15 fs.Close(); 16 StreamWriter sw = new StreamWriter("c:\\iotext.txt", true, Encoding.ASCII); 17 sw.Write("This is the appended line"); 18 sw.Close(); 19 } 20 } 21 }