Locale-Sensitive Windows C++ Functions
int wvnsprintf(LPTSTR lpOut, int cchLimitIn, LPCTSTR pszFmt, va_list arglist);
int wvnsprintfA(LPSTR lpOut, int cchLimitIn, LPCSTR pszFmt, va_list arglist);
int wvnsprintfW(LPWSTR lpOut, int cchLimitIn, LPCWSTR pszFmt, va_list arglist);
Internationalization (I18n) Function Overview
The wvnsprintf function is a Microsoft Windows version of sprintf.
It writes output to lpOut under control of
the pszFmt format argument. A null character is placed at the end of the string and the number of
characters written is returned, or a negative value if an error occurs. cchLimitIn is the maximum number of characters written to lpOut .
wvnsprintfA is the narrow version of the function; its arguments are single-byte or multibyte strings, and cchLimitIn is a byte size.
wvnsprintfW is the wide version of the function; its arguments are wide-character strings, and cchLimitIn is a wide-character size.
See the MSDN Library
for more information.
I18n Issues
Use the appropriate version of the function as required for internationalization support,
ensuring that cchLimitIn is set correctly for the chosen platform: bytes for
the narrow version and WCHARs for the wide version.
See Locale-Sensitive Length Functions for a discussion on multibyte
and wide character sizes.
Where locale-dependent numeric formatting is required, use the locale-sensitive
GetNumberFormat function to first format numbers and then
insert them as strings, rather than using the %d or %i format options,
which are locale-independent.
See String Formatting in C and C++ for a discussion on locale-sensitive formatting in internationalized applications.
Recommended Replacements*
Due to the security risks of this function, consider using a safe string function.
If wvnsprintf is called, use the Generic version of the function rather than explicitly calling the narrow or wide versions. wvnsprintf
will be mapped to wvnsprintfW when the program is compiled with the #define UNICODE switch, and to wvnsprintfA otherwise.
Using the Generic version facilitates switching between an MBCS and UTF-16 Unicode application.
These are shown as the first choices in the following table:
*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.
|