[Previous]
[Contents]
[Next]

va_end()

finish getting items from a variable argument list

Synopsis:

#include <stdarg.h>
void va_end( va_list param );

Description:

va_end() is a macro used to complete the acquisition of arguments from a list of variable arguments. It must be used with the associated macros va_start() and va_arg(). See the description for va_arg() for complete documentation on these macros.

Examples:

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

#define ESCAPE 27

void tprintf( int row, int col, char *fmt, ... )
 {
    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;
    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

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

Caveats:

va_end() is a macro.

See also:

va_arg(), va_start(), vfprintf(), vprintf(), vsprintf()


[Previous]
[Contents]
[Next]