The first parameter required by wsprintf is lptstr. if the environment is Unicode, lptstr is equivalent to wchar_t *, which is a wide character pointer and char * in a non-Unicode environment *.
The function for formatting strings is as follows. For detailed usage, you can view msdn, which is similar to the one described above:
Sprintf Single-byte C/C ++ library functions
Swprintf Wide-byte C/C ++ library functions
The above wsprintf looks very similar to the above two functions. Don't confuse them. The W at the beginning of wsprintf does not represent wide, but the W at windows, it indicates the Windows API function. In fact, it is a macro. As mentioned above, the real API function is actually wsprintfa and wsprintfW, in less strict cases, we usually say that wsprintf is a function.
1. c function/Windows API function (C function can be used across platforms. winapi generally has multiple letters w and can run in kernel mode)
_ Stprintf
Wsprintf
2. ASCII (MBCS)/Unicode (the Unicode version of the C function is usually one more W, and the Windows version is differentiated by the suffix A or W)
_ Stprintf/sprintf/swprintf
Wsprintf/wsprintfa/wsprintfW
3. Variable Parameter/va_list (the va_list version usually has one more V)
_ Stprintf/sprintf/swprintf
Wsprintf/wsprintfa/wsprintfW
_ Vtprintf/vprintf/vwprintf
Wvsprintf/wvsprintfa/wvsprintfw
4. The suffix _ p indicates the parameter serial number and type (positional) used in the format characters similar to % 1 $ S. The suffix _ L indicates that the character set type (local) can be specified)
_ Tprintf_p/_ printf_p/_ wprintf_p
_ Tprintf_l/_ printf_l/_ wprintf_l
_ Tprintf_p_l/_ printf_p_l/_ wprintf_p_l
5. Others (check the required buffer size)
_ Sctprintf/_ scprintf/_ scwprintf
_ Sctprintf_l/_ scprintf_l/_ scwprintf_l
_ Sctprintf_p/_ scprintf_p/_ scwprintf_p
_ Sctprintf_p_l/_ scprintf_p_l/_ scwprintf_p_l
6. Security version
The Security version function of the string with buffer size check followed by _ s
Strcpy/strcpy_s
For C ++, these functions have a template overload of the char array.
# DEFINE _ crt_secure_cpp_overload_secure_names 1
When strcpy uses char [] as the parameter, it will be automatically converted from the overload to the call to strcpy_s.
7. Functions with buffer size restrictions, usually with an additional letter N
If the Count parameter is set to _ truncate, the data will be truncated if the data is too long.
_ Sntprintf/_ snprintf/_ snwprintf
_ Sntprintf_l/_ snprintf_l/_ snwprintf_l
_ Sntprintf_s/_ snprintf_s/_ snwprintf_s
_ Sntprintf_s_l/_ snprintf_s_l/_ snwprintf_s_l
_ Vsntprintf/_ vsnprintf/_ vsnwprintf
_ Vsntprintf_l/_ vsnprintf_l/_ vsnwprintf_l
_ Vsntprintf_s/_ vsnprintf_s/_ vsnwprintf_s
_ Vsntprintf_s_l/_ vsnprintf_s_l/_ vsnwprintf_s_l
[Thank you for your reference]
Http://zxjgoodboy.blog.sohu.com/136236437.html