|
@@ -149,32 +149,18 @@ namespace Global
|
|
|
_tcscpy_s(szLastLog, g_szLogPath);
|
|
|
if ( gp_log_fp != NULL )
|
|
|
{
|
|
|
+ WriteTextLog(_T("关闭文件:%s"), g_szLogPath);
|
|
|
fclose(gp_log_fp);
|
|
|
gp_log_fp = NULL;
|
|
|
}
|
|
|
-#if 0
|
|
|
- int fd = 0;
|
|
|
- if (_tsopen_s(&fd, g_szLogPath, _O_CREAT | _O_WRONLY | _O_APPEND, _SH_DENYRW, _S_IREAD | _S_IWRITE))
|
|
|
- {
|
|
|
- WriteTextLog(_T("创建文件描述符失败:%s,%d,%d"), g_szLogPath, nErr, GetLastError());
|
|
|
- return;
|
|
|
- }
|
|
|
|
|
|
- // 创建并打开文件;
|
|
|
- gp_log_fp = _tfdopen(fd, _T("w+"));
|
|
|
- if (gp_log_fp == NULL )
|
|
|
- {
|
|
|
- WriteTextLog(_T("创建文件失败:%s,%d,%d"), g_szLogPath, nErr, GetLastError());
|
|
|
- return;
|
|
|
- }
|
|
|
-#else
|
|
|
nErr = _tfopen_s(&gp_log_fp, g_szLogPath, "w+");
|
|
|
if ( gp_log_fp == NULL )
|
|
|
{
|
|
|
WriteTextLog(_T("创建文件失败:%s,%d,%d"), g_szLogPath, nErr, GetLastError());
|
|
|
return;
|
|
|
}
|
|
|
-#endif
|
|
|
+ WriteTextLog(_T("创建文件成功:%s"), g_szLogPath);
|
|
|
}
|
|
|
|
|
|
if (gp_log_fp == NULL )
|
|
@@ -200,6 +186,7 @@ namespace Global
|
|
|
AutoThreadSection aSection(&g_critSection);
|
|
|
if ( gp_log_fp )
|
|
|
{
|
|
|
+ WriteTextLog(_T("关闭文件:%s"), g_szLogPath);
|
|
|
fclose(gp_log_fp);
|
|
|
gp_log_fp = NULL;
|
|
|
}
|