void __inline __cdecl StdFormatA(std::string &buf, const char *format, ...)
{
va_list vl;
long nCount;
char *lpBuffer;
va_start(vl, format);
nCount = _vscprintf(format, vl) + 1;
lpBuffer = new char[nCount];
_vsnprintf_s(lpBuffer, nCount, _TRUNCATE, format, vl);
buf = std::string(lpBuffer);
delete[] lpBuffer;
va_end(vl);
}
void __inline __cdecl StdFormatW(std::wstring &buf, const wchar_t *format, ...)
{
va_list vl;
long nCount;
wchar_t *lpBuffer;
va_start(vl, format);
nCount = _vscwprintf(format, vl) + 1;
lpBuffer = new wchar_t[nCount];
_vsnwprintf_s(lpBuffer, nCount, _TRUNCATE, format, vl);
buf = std::wstring(lpBuffer);
delete[] lpBuffer;
va_end(vl);
}
STL::STRING格式化字符串
最新推荐文章于 2024-09-27 16:04:49 发布