C++ 安全拼接字符串函数

void SafeStrAppend(char buf[], const uint32_t maxBufSize, uint32_t &offset, const char *format, ...)
{
    if (offset < maxBufSize)
    {
        va_list ap;
        va_start(ap, format);
        offset += vsprintf(buf + offset, format, ap);
        va_end(ap);
    }
}
原文地址:https://www.cnblogs.com/tangxin-blog/p/6028305.html