char sz_arg[50];
sprintf(arg[50],”%s%s%s%s”,”参数1”,“参数2”,”参数三“,。。。);
va_list argList;
va_start(argList, sz_arg);
//获取不确定参数个数后存入argList结构体中
//加入些日志的时间
char szLogTimeBuf[128];
time_t stCurtime;
time(& stCurtime);
struct tm *ti = localtime((const time_t*)&stCurTime);
int timeSize = snprintf(szLogTimeBuf,128,”sdk_time:%02u:%02u:%02u:%02u:%02u:%02u”,ti->tm_mon+1,ti->tm_mday,ti->tm_hour,ti->tm_min,ti->tm_sec);
char *pszBufTemp = szLogTimeBuf - timeSize;
unsigned int bufsize = 128-1-timeSize;
intiSize =vsnprintf(pszBufTemp, uBufSize, lpszFmt, argList);
if(iSize >0&& ((unsignedint)iSize +3) < uBufSize)
{
if(pszBufTemp[iSize-1]!='\n')
{
pszBufTemp[iSize++] ='\r';
pszBufTemp[iSize++] ='\n';
}
pszBufTemp[iSize] ='\0';
}
else
{
szLogBuffer[128-1]=0;
}
va_end(argList)