LoadRunner sprintf and lr_eval_string

c++loadrunner

I am facing some issues that I'm certain is correct code, as I've seen it work before today, and without any changes made to the script, only a VUGen version change/upgrade.

HP Virtual User Generator:: Version: 12.02.0.0

ClockingIDCount = atoi(lr_eval_string("{ClockingID_count}"));

lr_output_message("CIDCount:%d",ClockingIDCount);
lr_output_message("ClockingID1::%s",lr_eval_string("{ClockingID_1}"));

for (i = 1; i <= ClockingIDCount; i++) {
    sprintf(loopParam, "{ClockingID_%d}", i);
    lr_output_message("ClockingID: %s %s %s", loopParam, lr_eval_string("{loopParam}"), lr_eval_string(lr_eval_string("{loopParam}")));
}

Outputs:

Action.c(120): CIDCount:21
Action.c(121): Notify: Parameter Substitution: parameter "ClockingID_1" =  "6829888"
Action.c(121): ClockingID1::6829888

But using the sprintf function to iterate over the items captured, returns;

Action.c(125): ClockingID: {ClockingID_1} {loopParam} {loopParam}

Note: I'm aware the 3rd %s evaluation shouldn't work – was just a thought as I've seen it resolve things like this before.

Best Solution

Code tampered!

Solution :: Remove the "{ }" from the lr_eval_string function;

Solution :: lr_output_message("ClockingID: %s", lr_eval_string(loopParam));