_vsnprintf, _vsnwprintf

Write formatted output using a pointer to a list of arguments.

int _vsnprintf( char *buffer, size_t count, const char *format, va_list argptr );

int _vsnwprintf( wchar_t *buffer, size_t count, const wchar_t *format, va_list argptr );

Routine Required Header Optional Headers Compatibility
_vsnprintf <stdio.h> and <stdarg.h> <varargs.h>1 Win 95, Win NT
_vsnwprintf <stdio.h> or <wchar.h>, and <stdarg.h> <varargs.h>1 Win 95, Win NT

1 Required for UNIX V compatibility.

For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version

Return Value

_vsnprintf and _vsnwprintf return the number of characters written, not including the terminating null character, or a negative value if an output error occurs. For _vsnprintf, if the number of bytes to write exceeds buffer, then count bytes are written and –1 is returned.

Parameters

buffer

Storage location for output

count

Maximum number of characters to write

format

Format specification

argptr

Pointer to list of arguments

Remarks

Each of these functions takes a pointer to an argument list, then formats and writes the given data to the memory pointed to by buffer.

Generic-Text Routine Mappings

TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_vsntprintf _vsnprintf _vsnprintf _vsnwprintf

Stream I/O Routinesvprintf Functions Overview

See Also   fprintf, printf, sprintf, va_arg