void CLQLlistDlg::WriteEventLog()
{
CString path1 = Getpath() + "\\data";//创建文件的路径
CreateDirectory(path1, NULL);//创建文件
CFileFind ff;
CString tm1 = GetTime();//获得时间
CString path = Getpath() + "\\data";//获得文件的路径
CString csData = "[" + tm1 + "]" + " " + "登录工程师账号" + "\n";//写入日记的内容
if (!ff.FindFile(path))
{
MessageBox("日志文件夹不存在,请创建", "提示", MB_ICONHAND | MB_OK);
return;
}
CString Fullpath = path + "\\" + "log_" + tm1 + ".log";//以时间为日记命名
FILE *file = fopen(Fullpath, "a");//打开文件
if (file == NULL)
{
CString str;
str.Format("打开[%s]失败", Fullpath);
MessageBox(str);
return;
}
fwrite(csData, 1, strlen(csData), file);//写入内容
fclose(file);//关闭日志
}
08-30
216
09-14
674
12-31
10-01
06-25