Krishna Logo
Divied
Call: Sana @ (571) 386-2972

 

Loading
Latest News
Home Navigation Divied
INTERVIEW Navigation Divied LOADRUNNER Navigation Divied How to convert a parameter to an integer
How To Convert A Parameter To An Integer
How to convert a parameter to an integer

 

Problem Description: How to convert a parameter to an integer


Solution: Use the atoi function

To convert a parameter to integer:
1. Covert the parameter to a string using lr_eval_string.

Example:
lr_eval_string("{Parameter_name}")

2. Convert the string to a number using atoi.

Example:
x=atoi(lr_eval_string("{Parameter_name}") );

Example:
Action()
{
int x;
char temp[20];

/* Tell LoadRunner what to look for in next return from server*/
web_reg_save_param("example", "LB=copy; ", "RB=, Mercury Corporation ",LAST);

/* Make request of server that returns the data we are looking for */
web_url("MERCURY", "URL=http://www.mercury.com", LAST);

/* Check to see what was captured */
lr_output_message("%s", lr_eval_string("{example}") );

/*Convert the parameter to a string, and convert the string to a number*/
x=atoi(lr_eval_string("{example}") );

/* Output the number*/
lr_output_message("%d", x);

return 0;
}

 


Shadow Bottom
 
 
© 2005 - 2018 Krishna Training.
Designed & Developed By BitraNet