StringCchPrintf
http://msdn.microsoft.com/en-us/library/windows/desktop/ms647541(v=vs.85).aspx
函数原型
HRESULT StringCchPrintf( _Out_ LPTSTR pszDest, _In_ size_t cchDest, _In_ LPCTSTR pszFormat, _In_ ... );
#include <tchar.h>
#include <Strsafe.h>
示例
int code = 100;
TCHAR szMsg[1024] = {0};
StringCchPrintf(szMsg, _countof(szMsg), _T("Code:0x%x"), code);
wsprintf
http://msdn.microsoft.com/en-us/library/windows/desktop/ms647550(v=vs.85).aspx
函数原型
int __cdecl wsprintf(
_Out_ LPTSTR lpOut,
_In_ LPCTSTR lpFmt,
_In_ ...
);
头文件
Winuser.h (include Windows.h)
示例
int code = 100;
TCHAR szMsg[1024] = {0};
wsprintf(szMsg, _T("Code:0x%x"), code);