vprintf()                Write Formatted Data to Stdout
 
 #include   <stdio.h>
 #include   <varargs.h>                 Use for UNIX V compatibility
 #include   <stdarg.h>                  Use for ANSI C standard compatibility
 
 int        vprintf(format-string,arg-ptr);
 char       *format-string;              Format control
 va_list    arg-ptr;                     Pointer to list of arguments
 
    vprintf() formats and prints a series of characters and values to the
    standard output stream 'stdout'. It is similar to printf() except
    that is accepts a pointer to a list of arguments rather than a list
    of arguments.
 
    'arg-ptr' has the type 'va_list'.  It is defined in <varargs.h>
    (required for UNIX V compatibility ) and <stdarg.h> (required for
    compatibility with proposed ANSI C standard).  'arg-ptr' points to a
    list of arguments.  These arguments are converted and output
    according to specifications in 'format-string'.  (For the inner
    workings of variable-length parameter lists, see va_start(),
    va_arg(), and va_end()).
 
    See printf() for a complete description of 'format-string'.
 
  -------------------------------- Example ---------------------------------
 
    The following statements write data to the console.
 
         #include <stdio.h>
         #include <stdarg.h>
 
         int x;
         main()
         {
             char *date = "12/21/86";
             char *header = "ANNUAL REPORT";
 
                 putdata("Data from : %s, (%s)\n",header,date);
                 for (x = 0; x < 100; x++)
                     putdata("%d",x);
                 putdata("\nEnd of Report\n");
                 fclose(stream);
             }
         }
 
         putdata(fmt_str)
         char *fmt_str;
         {
              va_list arg_ptr;
 
              va_start(arg_ptr,fmt_str);
              vprintf(fmt_str,arg_ptr);
              va_end(arg_ptr);
         }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster