Share via


vsprintf, vswprintf

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

intvsprintf(char*buffer,constchar*format,va_listargptr**);**

intvswprintf(wchar_t*buffer,constwchar_t*format,va_listargptr**);**

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