在使用 strcat 函数而不是 s printf 转换以下格式时,我需要一些帮助。
const char* const MSG_STAMP_PRINTF_FORMAT = "%c %04d-%02d-%02d %02d:%02d:%02d.%03d";
char cMsgStamp[500];
char cSevChr = 'I';
struct tm gmt;
// Calculate Day/Hour/Min/Sec
gmtime_r((time_t *)&pMsg->iSysTimeSec, &gmt);
int iSysTimeMs = 100;
// Format the begining of the message, the message stamp
sprintf(&cMsgStamp[0],
MSG_STAMP_PRINTF_FORMAT,
cSevChr, gmt.tm_year+1900, gmt.tm_mon + 1, gmt.tm_mday, gmt.tm_hour, gmt.tm_min, gmt.tm_sec,iSysTimeMs
); is 0x%s\n", n3);
而不是使用 sprintf,我必须使用 strcat 函数的数量来获取上面 cMsgStamp 中存在的相同信息。
谁可以帮我这个事。谢谢!文卡塔 RKA