Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ () — Motorola System V 88k Release 3.2 Version 1.2C

Media Vault

Software Library

Restoration Projects

Artifacts Sought



  VPRINTF(3S)     (C Programming Language Utilities)    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 the use of vfprintf to write an
       error routine.

       #include <stdio.h>
       #include <varargs.h>
            .
            .
            .
       /*
        *   error should be called like
        *      error(function_name, format, arg1, arg2...);  */
       /*VARARGS*/


  Page 1                                                   May 1989


















  VPRINTF(3S)     (C Programming Language Utilities)    VPRINTF(3S)



       void
       error(va_alist)
       /* Note that the function_name and format arguments cannot be
        *    separately declared because of the definition of varargs.  */
       va_dcl
       {
            va_list args;
            char *fmt;


































  Page 2                                                   May 1989


















  VPRINTF(3S)     (C Programming Language Utilities)    VPRINTF(3S)



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

  SEE ALSO
       printf(3S), varargs(5).






























  Page 3                                                   May 1989
















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