contents   index   previous   next



Clib.vscanf()

syntax:

Clib.vscanf(formatString, valist)

where:

formatString - string that specifies the final format.

 

valist - a variable list of arguments to be used according to formatString.

 

return:

number - input items assigned. This number may be fewer than the number of parameters requested if there is a matching failure during input.

 

description:

This method gets formatted input from the standard input stream, the keyboard, using a variable number of arguments. This method is similar to Clib.scanf() except that it takes a variable argument list. See Clib.scanf() and Clib.va_start() for more information.

 

The method Clib.vscanf() modifies any number of parameters following formatString, setting the parameters to data according to the specifications of the format string.

 

This method returns the number of input items assigned. This number may be fewer than the number of parameters requested if there is a matching failure during input.

 

The example function behaves like Clib.scanf(), including taking a variable number of input arguments, except that it beeps and tries again if there are zero matches:

 

see:

Clib.scanf()

 

example:

function Must_scanf(FormatString[,arg1 ...)

{

   Clib.va_start(valist, FormatString);

      // creates variable arg list 

   do 

   {  // mimic original scanf() call

      var count = Clib.vscanf(FormatString,

                              valist); 

      if ( 0 == count ) // if no match, beep 

         Screen.write("\a"); 

   } while( 0 == count );

      // if not match, try again 

   Clib.va_end(valist);

      // end using valist (optional) 

   return(count);

      // return as scanf() would 

}

 


Time functions