RAD Studio |  |

vprintf, vwprintf

Header File

stdio.h

Category

Console I/O Routines

Prototype

int vprintf(const char *format, va_list arglist);

int vwprintf(const wchar_t * format, va_list arglist);

Description

Writes formatted output to stdout.

Note: Do not use this function in Win32 GUI applications.
The v...printf functions are known as alternate entry points for the ...printf functions. They behave exactly like their ...printf counterparts, but they accept a pointer to a list of arguments instead of an argument list.
Note: For details on format specifiers, see Printf Format Specifiers.
vprintf accepts a pointer to a series of arguments, applies to each a format specifier contained in the format string pointed to by format, and outputs the formatted data to stdout. There must be the same number of format specifiers as arguments.

Return Value

vprint returns the number of bytes output. In the event of error, vprint returns EOF.

Example

Copy Code

    #include <stdio.h>
    #include <stdarg.h>
    int vpf(char *fmt, ...)
    {
       va_list argptr;
       int cnt;
       va_start(argptr, fmt);
       cnt = vprintf(fmt, argptr);
       va_end(argptr);
       return(cnt);
    }
    int main(void)
    {
       int inumber = 30;
       float fnumber = 90.0;
       char *string = "abc";
       vpf("%d %f %s\n",inumber,fnumber,string);
       return 0;
    }

Portability

| POSIX | Win32 | ANSI C | ANSI C++
vprintf | + | + | + | +
vwprintf |  | + | + | +

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!