Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdarg.h>
    void va_start( va_list param, previous );

Description:
     va_start is a macro used to start the acquisition of arguments from a
    list of variable arguments.  The param argument is used by the  va_arg
    macro to locate the current acquired argument.  The previous argument is
    the argument that immediately precedes the "..." notation in the
    original function definition.  It must be used with the associated
    macros  va_arg and  va_end.  See the description of  va_arg for complete
    documentation on these macros.

Returns:
    The macro does not return a value.

Example:
    #include <stdio.h>
    #include <stdarg.h>
    #include <time.h>

    #define ESCAPE 27

    void tprintf( int row, int col, char *fmt, ... )
     {
        auto va_list ap;
        char *p1, *p2;

        va_start( ap, fmt );
        p1 = va_arg( ap, char * );
        p2 = va_arg( ap, char * );
        printf( "%c[%2.2d;%2.2dH", ESCAPE, row, col );
        printf( fmt, p1, p2 );
        va_end( ap );
     }

    void main()
      {
        struct tm  time_of_day;
        time_t     ltime;
        auto char  buf[26];

        time( &ltime );
        _localtime( &ltime, &time_of_day );
        tprintf( 12, 1, "Date and time is: %s\n",
                _asctime( &time_of_day, buf ) );
      }

Classification:
    ANSI

Systems:
    MACRO

See Also:
    va_arg, va_end, vfprintf, vprintf, vsprintf

See Also: va_arg va_end

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson