beautypg.com

Vprintf, Vsprintf, Vprintf vsprintf – Zilog Z8F0130 User Manual

Page 501

background image

UM013037-1212

vprintf

Zilog Developer Studio II – Z8 Encore!

User Manual

477

Each call to f1 has in scope the definition of the function of a declaration such as

void

f1(int, ...);

vprintf

Equivalent to

printf

, with the variable argument list replaced by arg, which has been ini-

tialized by the

va_start

macro (and possibly subsequent

va_arg

calls). The

vprintf

function does not invoke the

va_end

function.

Synopsis

#include

#include

int vprintf(char *format, va_list arg);

Returns

The number of characters transmitted or a negative value if an output error occurred.

Example

va_list va;

/* initialize the variable argument va here */

vprintf("%d %d %d",va)

vsprintf

Equivalent to

sprintf

, with the variable argument list replaced by arg, which has been

initialized by the

va_start

macro (and possibly subsequent

va_arg

calls). The

vsprintf

function does not invoke the va_end function.

Synopsis

#include

#include

int vsprintf(char *s, char *format, va_list arg);

Returns

The number of characters written in the array, not counting the terminating null character.

Example

va_list va;

char buf[80];

/*initialize the variable argument va here*/

vsprint("%d %d %d",va);