vsprintf, vswprintf

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

int vsprintf( char *buffer, const char *format, va_list argptr );

int vswprintf( wchar_t *buffer, const wchar_t *format, va_list argptr );

Routine Required Header Optional Headers Compatibility
vsprintf <stdio.h> and <stdarg.h> <varargs.h>1 ANSI, Win 95, Win NT
vswprintf <stdio.h> or <wchar.h>, and <stdarg.h> <varargs.h>1 ANSI, 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

vsprintf and vswprintf return the number of characters written, not including the terminating null character, or a negative value if an output error occurs. For vswprintf, a negative value is also returned if count or more wide characters are requested to be written.

Parameters

buffer

Storage location for output

format

Format specification

argptr

Pointer to list of arguments

count

Maximum number of bytes to write

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
_vstprintf vsprintf vsprintf vswprintf

Stream I/O Routinesvprintf Functions Overview

See Also   fprintf, printf, sprintf, va_arg