码迷,mamicode.com
首页 > Windows程序 > 详细

c# 建立临时文件 并写入数据

时间:2018-02-11 12:25:16      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:body   coding   建立   nbsp   code   iter   pfile   path   div   

                    //建立临时文件
                      string tempFile = Path.GetTempFileName();
              string ls_fileNeme = System.IO.Path.ChangeExtension(ls_file, ".rep");
                        File.Move(ls_file, ls_fileNeme);//修改文件扩展名
                        using (FileStream fs = new FileStream(ls_fileNeme, FileMode.Open))
                        {
                            StreamWriter sw = new StreamWriter(fs, Encoding.Unicode);
                            sw.WriteLine("what are you doing");
                            sw.Flush();
                            sw.Close();
                        }        

 

c# 建立临时文件 并写入数据

标签:body   coding   建立   nbsp   code   iter   pfile   path   div   

原文地址:https://www.cnblogs.com/cxyzhangjie/p/8440623.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!