Operate File


1. 向文件中添加内容:
//create log file
if (System.IO.File.Exists("DeleteTempFilesLog.txt") == false)
{
    System.IO.FileStream fs = new System.IO.FileStream("DeleteTempFilesLog.txt", System.IO.FileMode.Create);
    fs.Close();
}
//add log
using (System.IO.StreamWriter sw = new System.IO.StreamWriter("DeleteTempFilesLog.txt", true))
{
    sw.WriteLine(logInfo);
    sw.WriteLine("-----------------------------------------------------");
}
posted on 2007-12-03 11:37  Edison Zhu  阅读(189)  评论(0编辑  收藏  举报