c#如何在新行中添加文本
2个回答
展开全部
string path= System.Windows.Forms.Application.StartupPath + "\\ErrorLog\\"+fileName +".txt"; //打开这个文件
if (!File.Exists(path))
{
FileInfo myfile = new FileInfo(path);
FileStream fs = myfile.Create();
fs.Close();
}
StreamWriter sw = File.AppendText(path);
sw.WriteLine("啊实打实的");//追加这一行
sw.Flush();
sw.Close();
if (!File.Exists(path))
{
FileInfo myfile = new FileInfo(path);
FileStream fs = myfile.Create();
fs.Close();
}
StreamWriter sw = File.AppendText(path);
sw.WriteLine("啊实打实的");//追加这一行
sw.Flush();
sw.Close();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询