
正文
C#-创建并添加TXT文件
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
public static void WriteToText(string txtContent, string txtPath)
{
using (FileStream fs = new FileStream(txtPath, FileMode.OpenOrCreate,FileAccess.Write))
{
using (StreamWriter sw=new StreamWriter(fs))
{
sw.BaseStream.Seek(, SeekOrigin.End);
sw.WriteLine("{0}\n", txtContent);
sw.Flush();
}
}
}








