woensdag 6 februari 2008

LoadRunner - Putting a double/float into a parameter

It took me two hours to figure it out, so I might as well share with the world. To put a 'double' or 'float' value in a new defined parameter in Loadrunner use following code:

---------

float nr;
nr = 0.01;
char strNr[4];
sprintf( strNr, "%1.2f", nr );
lr_save_string( strNr, "param_nr" );
lr_output_message("We are on nr #%s", lr_eval_string("{param_nr}"));


----------

output should be: We are on nr 0.01

PS: conversions to string from other datatypes are hell in C. (just venting)

Geen opmerkingen: