Operating systems, development tools, and professional services
for connected embedded systems
for connected embedded systems
![]() |
![]() |
![]() |
![]() |
vprintf()
Write formatted output to standard output (varargs)
Synopsis:
#include <stdio.h>
#include <stdarg.h>
int vprintf( const char* format,
va_list arg );
Arguments:
- format
- A string that specifies the format of the output. The formatting string determines what additional arguments you need to provide. For more information, see printf().
- arg
- A variable-argument list of the additional arguments, which you must have initialized with the va_start() macro.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The vprintf() function writes output to the file stdout, under control of the argument format.
The vprintf() function is a "varargs" version of printf().
Returns:
The number of characters written, or a negative value if an output error occurred (errno is set).
Examples:
Use vprintf() in a general error message routine:
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
void errmsg( const char* format, ... )
{
va_list arglist;
printf( "Error: " );
va_start( arglist, format );
vprintf( format, arglist );
va_end( arglist );
}
int main( void )
{
errmsg( "%s %d %s", "Failed", 100, "times" );
return EXIT_SUCCESS;
}
Classification:
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |
See also:
errno, fprintf(), fwprintf(), printf(), snprintf(), sprintf(), swprintf(), va_start() vfprintf(), vfwprintf(), vsnprintf(), vsprintf(), vswprintf(), vwprintf(), wprintf() vsprintf()
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)