c# 生成txt文件,写入内容

 string path = Application.StartupPath + "\\" + "timeLenth.txt";

            FileStream fs1 = new FileStream(path, FileMode.Create, FileAccess.Write);//搜索创建写入文件 
            StreamWriter sw = new StreamWriter(fs1);
           
                sw.Write("Content no other line");
                sw.Write("   ");
                sw.WriteLine("huanHang");
            
            sw.Close();
            fs1.Close();

            System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
            info.FileName = path;
            System.Diagnostics.Process.Start(info);

 

 

posted @ 2014-03-13 16:49  二哥(阿伟)  阅读(2375)  评论(0编辑  收藏  举报