Value of a String Variable is found to be corrupted
Question ID: 106479
3
0

Value of a String Variable [char *Variable] is found to be corrupted after web_reg_save function call is made.
If a statement lr_output_message("Value: %s",lr_eval_string(Variable )); is written before the web_reg_save/ex code block,the actual value of the variable is printed in the output.

But if the same output statement is written after the web_reg_save/ex code block, a garbage value is printed.

I have tried this from multiple machines and tried clearing the old script result files as well, but the issue still persists.

Marked as spam
Posted by (Questions: 23, Answers: 4)
Asked on October 27, 2015 5:16 pm
107 views
Answers (1)
4
Private answer

From looking at your description, it appears that you are trying to use a pointer to a string while working with the web register save function calls. These functions do not return a pointer to a string. They return a pointer to a structure of type LPCSTR. This is why you use lr_eval_string to print parameter values. The following is an example: ...
web_reg_save_param(''Parameter'', ''LB=value='', ''RB=&'', ''NotFound=ERROR'', LAST);
Lr_output_message(''Value: %s'', lr_eval_string(''{Parameter}''));
...

The output message function above prints the string component from a pointer to the LPCSTR structure ''Parameter''.

Marked as spam
Posted by (Questions: 4, Answers: 41)
Answered on October 27, 2015 5:20 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top