(GCOS-8 only)
#include <stdarg.h> retval = _vapply( function_ptr, arglist );
"_vapply" constructs and executes a call to the specified function. The arguments in the "arglist" variable argument list are passed to the function and the value which the function returns is returned to "retval".
"_vapply" is particularly useful for routines which are called with a variable number of arguments and which wish to pass these arguments on to another function.
#include <stdio.h> #include <stdarg.h> #include <time.h> logmsg( const struct tm *logtime, ...) { /* format message with time, then print out stdout */ va_list ap; va_start(ap,logtime); printf("%s:\n",asctime(logtime)); _vapply(printf,ap); va_end(ap); }
Note: this is just an artificial example. You would normally use the "vprintf" function for this purpose.
Copyright © 1996, Thinkage Ltd.