函数需要输入多个参数时,象sprintf的用法一样:
void
WriteLog2(
bool
bNeedTime,
const
char
*
fmt, )
{
if
(fpLog
==
NULL)
return
;
SYSTEMTIME tm;
GetLocalTime(
&
tm);
if
(bNeedTime)
{
fprintf(fpLog,
"
%02d:%02d:%02d.%03d\t
"
, tm.wHour, tm.wMinute, tm.wSecond, tm.wMilliseconds);
}
va_list pArg;
va_start(pArg, fmt);
fprintf(fpLog, fmt, pArg);
va_end(pArg);
fputs(
"
\n
"
, fpLog);
}