日期:2014-05-18 浏览次数:20802 次
FileStream fs; StreamWriter sw; string strContent; string strDir = @"D:\ST"; string strPath; strPath = strDir + @"\S1.txt"; // S1.txt文件全路径 fs = new FileStream(strPath, FileMode.OpenOrCreate); sw = new StreamWriter(fs, Encoding.Default); strContent = WriteToS1(); // 生成S1文件的内容 sw.Write(strContent); strPath = strDir + @"S2.txt"; // S2.txt文件全路径 fs = new FileStream(strPath, FileMode.OpenOrCreate); sw = new StreamWriter(fs, Encoding.Default); strContent = WriteToS2(); // 生成S2文件的内容 sw.Write(strContent); sw.Close();