Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ vsprintf(3s) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

vprintf(3X)

varargs(5)



vprintf(3S)               AT&T SYSTEM V               vprintf(3S)



NAME
     vprintf, vfprintf, vsprintf - print formatted output of a
     varargs argument list

SYNOPSIS
     #include <stdio.h>
     #include <varargs.h>

     int vprintf (format, ap)
     char *format;
     valist ap;

     int vfprintf (stream, format, ap)
     FILE *stream;
     char *format;
     valist ap;

     int vsprintf (s, format, ap)
     char *s, *format;
     valist ap;

DESCRIPTION
     vprintf, vfprintf, and vsprintf are the same as printf,
     fprintf, and sprintf respectively, except that instead of
     being called with a variable number of arguments, they are
     called with an argument list as defined by varargs(5).

EXAMPLE
     The following demonstrates how vprintf could be used to
     write an error routine.

     #include <stdio.h>
     #include <varargs.h>
          .
          .
          .
     /*
      *   error should be called like
      *        error(functionname, format, arg1, arg2...);
      */
     /*VARARGS0*/
     void
     error(vaalist)
     /* Note that the functionname and format arguments cannot be
      *      separately declared because of the definition of varargs.
      */
     vadcl
     {
          valist args;
          char *fmt;

          vastart(args);



Page 1                        CX/UX Programmer's Reference Manual





vprintf(3S)               AT&T SYSTEM V               vprintf(3S)



          /* print out name of function causing error */
          (void)fprintf(stderr, "ERROR in %s: ", vaarg(args, char *));
          fmt = vaarg(args, char *);
          /* print out remainder of message */
          (void)vprintf(fmt, args);
          vaend(args);
          (void)abort( );
     }

SEE ALSO
     vprintf(3X), varargs(5).












































Page 2                        CX/UX Programmer's Reference Manual



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026