首页 > 其他 > 详细

写入文件txt

时间:2016-07-12 23:27:37      阅读:334      评论:0      收藏:0      [点我收藏+]

         FileStream fs = new FileStream(@"d:\service.txt", FileMode.OpenOrCreate, FileAccess.Write);
            StreamWriter sw = new StreamWriter(fs); 
            using ( fs)
            {
                using (sw)
                {
                    sw.BaseStream.Seek(0, SeekOrigin.End);
                    sw.WriteLine("WindowsService: Service Started" + DateTime.Now.ToString() + "\n");
                    sw.Flush(); 
                }
            }

写入文件txt

原文:http://www.cnblogs.com/change4now/p/5665202.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!