vprintf

Writes output to stdout under format control

Local Servers:blocking
Remote Servers:blocking
Classification:ANSI
Platform:NLM
Service:Stream I/O

Syntax

  #include <stdarg.h>  
  #include <stdio.h>  
   
  int  vprintf  (  
     const char   *format,   
     va_list       arg);
  

Parameters

format
(IN) Points to the format control string.
arg
(IN) Specifies a variable argument.

Return Values

The vprintf function returns the number of characters written or a negative value if an output error occurred. If an error occurs, errno is set.

Remarks

The vprintf function writes output to the file stdout under control of the argument format. The format string is described under the description for printf. The vprintf function is equivalent to printf, with the variable argument list replaced with arg, which has been initialized by the va_start macro.

See Also

fprintf, printf, sprintf, va_arg, va_end, va_start (NDK: Program Management)

vprintf Example

The following shows the use of vprintf in a general error message routine.

  #include <stdarg.h>  
  #include <stdio.h>  
   
  void errmsg (char *format, ... )  
  {  
     va_list arglist;  
     printf ("Error: ");  
     va_start (arglist, format);  
     vprintf (format, arglist);  
     va_end (arglist);  
  }