打印时间log

BOOL ApplyWB_TestItem::TimeLog(WCHAR*LogPath,WCHAR*Log)

{

SYSTEMTIME time;

GetLocalTime(&time);

FILE* fpWrite = _wfopen(LogPath,_T("a+")); //a+ 代表括追加

WCHAR Time[512];

wsprintf(Time,_T("Time:%d-%d-%d-%d:%d:%0.2d:%0.3d__%s"),time.wYear,time.wMonth,time.wDay,time.wHour,time.wMinute,time.wSecond,time.wMilliseconds,Log);

fwprintf(fpWrite,_T("%s\n"),Time);

fclose(fpWrite);

return 0;

}

你可能感兴趣的:(Windows编程)