wvnsprintfA function (shlwapi.h)

Takes a list of arguments and returns the values of the arguments as a printf-style formatted string.

Note  Do not use this function. See Remarks for alternative functions.


int wvnsprintfA(
  [out] PSTR    pszDest,
  [in]  int     cchDest,
  [in]  PCSTR   pszFmt,
  [in]  va_list arglist


[out] pszDest


A pointer to a buffer that, when this function returns successfully, receives the output string.

[in] cchDest

Type: int

The maximum number of characters allowed in pszDest.

[in] pszFmt


A printf-style format string. The %s format identifier should never be used in an unbounded form. To avoid potential buffer overruns, always specify a size; for instance "%32s".

[in] arglist

Type: va_list

A pointer to a list of command-line parameters used to customize the output.

Return value

Type: int

Returns the number of characters written to the buffer, excluding any terminating NULL characters. A negative value is returned if an error occurs.


Security Warning:  Using this function incorrectly can compromise the security of your application. The copied string is not guaranteed to be null-terminated. Consider using one of the following alternatives. StringCbPrintf, StringCbPrintfEx, StringCbVPrintf, StringCbVPrintfEx, StringCchPrintf, StringCchPrintfEx, StringCchVPrintf, or StringCchVPrintfEx. You should review Security Considerations: Microsoft Windows Shell before continuing.


The shlwapi.h header defines wvnsprintf as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (version 5.0 or later)