Example: lrc_variant_scode

This example shows two ways of creating an scode variant with dynamic data.

VARIANT var ;
char varVal[80];
char errVal[15];
int i;

/* To use a variable in the call to lrc_variant_scode:
Get an error code string however appropriate for your test */

my_get_error_code_function(errval );
lr_output_message("err val = %s", errval );

//Action.c(11): err val = -9876543
// Pass the string variable as the function argument
var = lrc_variant_scode(errval );
lrc_print_variant(var);

// Action.c(15): Variant of type: scode ,with value: -9876543
/* To use parameterization in the call to lrc_variant_scode:
    Use standard parameter semantics. Either define
    the parameter in the script, or retrieve it from input. */

for (i = 0; i<4; i++) {
/* The parameter errcode is defined in the script with values:
-2147352572
-200000000
-300000000
-400000000 */

	var = lrc_variant_scode("<errcode>");
	lrc_print_variant(var);
	lr_advance_param("errcode");
}
Output:
Action.c(31): Variant of type: scode ,with value: -2147352572
Action.c(31): Variant of type: scode ,with value: -200000000
Action.c(31): Variant of type: scode ,with value: -300000000
Action.c(31): Variant of type: scode ,with value: -400000000