C# 随笔写txt
public static void writerfile(string file)
{
string path = appdomain.currentdomain.basedirectory;
//如果不存在,则创建目录
if (!directory.exists(path + "log/"))
{
directory.createdirectory(path + "log/");
}
filestream fs = new filestream(path + "\\log/log" + datetime.now.tostring("yyyymmdd") + ".txt", filemode.append);
streamwriter streamwriter = new streamwriter(fs);
streamwriter.basestream.seek(0, seekorigin.end);
streamwriter.writeline(datetime.now.tostring() + " " + file);
streamwriter.flush();
streamwriter.close();
fs.close();
}
上一篇: 体检前可以喝水吗?体检前可以吃东西吗?
下一篇: 你知道湿疹宝宝妈妈吃什么好