contents   index   previous   next



Clib.va_start()

syntax:

Clib.va_start(valist[, inputVar])

where:

valist - a variable list of arguments passed to a function.

 

return:

number - calls to Clib.va_arg(), that is, the number of variables in valist.

 

inputVar - an optional initial parameter for the variable parameter list.

 

description:

This method initializes valist for a function with a variable number of arguments. After the first call to this function, subsequent calls to Clib.va_arg() may be used to get the rest of the parameters in sequence.

 

The parameter inputVar must be one of the parameters defined on the function line of a function. The first argument returned by the first call to Clib.va_arg() will be the variable passed after inputVar. If inputVar is not provided, then the first parameter passed to a function will be the first one returned by Clib.va_arg(valist).

 

see:

Clib.va_end(), Clib.va_start(), Clib.vfprintf(), Clib.vfscanf(), Clib.vprintf(), Clib.vscanf(), Clib.vsprintf(), Clib.vsscanf()

 

example:

// The following example uses and accepts

// a variable number of strings and

// concatenates them all together.

 

function MultiStrcat(Result, InitialString);

   // Append any number of strings to InitialString.

   // e.g., MultiStrcat(Result,

   // "C:\\","FOO",".","CMD") 

{

   Clib.strcpy(Result,""); // initialize result;

   var Count = Clib.va_start(ArgList, InitialString);

   for (var i = 0; i < Count; i++) 

      Result, va_arg(ArgList));

}

 


Clib.vfprintf()