Share this page

# Modifying saved parameters

After you save a value to a parameter, you may need to modify it before using it in your script. If you need to perform arithmetical operations on a parameter, you must change it from a string to an integer using the atoi or atol C functions. After you modify the value as an integer, you must convert it back to a string to use the new variable in your script.

In the following Winsock example, the data at offset 67 was saved to the parameter, param1. Using atol, VuGen converted the string to a long integer. After increasing the value of param1 by one, VuGen converted it back to a string using sprintf and saved it as a new string, new_param1. The value of the parameter is displayed using lr_output_message. This new value may be used at a later point in the script.

    lrs_receive("socket2", "buf47", LrsLastArg);lrs_save_param("socket2",
                       NULL, "param1", 67, 5);
    lr_output_message ("param1: %s", lr_eval_string("<param1>"));
    sprintf(new_param1, "value=%ld", atol(lr_eval_string("<param1>")) + 1);
    lr_output_message("ID Number:"%s" lr_eval_string("new_param1"));

Back to top

https://admhelp.microfocus.com VuGen,Professional Performance Engineering,Performance Engineering for Developers 8942
Tips to improve your search results... OpenText™ Virtual User Generator Help Center OpenText™ VuGen Help 25.1-25.3 All View Local Help Center View Online Help Center Version: