C#写TXT文档

//C#写TXT文档          
 String strDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
            string filePath = strDir + "\putin.txt";
            FileStream fs = new FileStream(filePath, FileMode.Append);
            StreamWriter sw = new StreamWriter(fs);
            //开始写入
            sw.Write(sUsr + "
");
            sw.Write(sPwd + "
");
            //清空缓冲区
            sw.Flush();
            //关闭流
            sw.Close();
            fs.Close()
原文地址:https://www.cnblogs.com/fish7/p/4067063.html