当前位置: 移动技术网 > IT编程>开发语言>.net > C# 随笔写txt

C# 随笔写txt

2019年07月25日  | 移动技术网IT编程  | 我要评论

宜为凯姆,不敢哭,如果不是你 游艺湉

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();

}

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网