loadrunner Lr_类函数之 lr_eval_string_ext_free()

lr_eval_string_ext_free()

释放由lr_eval_string_ext分配的缓冲区。

void lr_eval_string_ext_free(const char** param);

 

参数说明:

 param指向缓冲区的指针。

lr_eval_string_ext_free函数释放由lr_eval_string_ext分配的内存。

 

示例:lr_eval_string_ext_free

在以下示例中,lr_eval_string_ext_free函数在关联期间释放由lr_eval_string_ext分配的缓冲区。

/ *原始网址/

web_url(“Response_1.dat”,

“URL = http://209.88.184.66/SmWeb/Data/S_DFFA13B8DFB711D3AA6D009027E00675/Response_1.dat”,

 

“RecContentType = application / octet-stream”,

“SupportFrames = 0”,

LAST);

 

web_save_header(RESPONSE,“headerVar”)

web_create_html_param(“returnedBuffer”,“”,“”);

web_submit_data(“SmartWeb.asp”,

    “Action =http:/207.86.104.1/SmWeb/Asp/SmartWeb.asp?App = Web&SmStream @,

“Method = POST”,

“TargetFrame =”,

“RecContentType = application / octet-stream”,

“SupportFrames = 0”,

ITEMDATA,

“name =?App”,

“value = Web”,

ENDITEM,

“name = SmStream @ Request”,

“value = ClassDescription”,

ENDITEM,

LAST);

 

/ *计算头的长度* /

len = strlen(lr_eval_string(“{headerVar}”));

/ *获取指向缓​​冲区的指针* /

lr_eval_string_ext(“{Param1}”,8,&newParam,&prmLen,0,0,-1);

//保存缓冲区地址

newParamAdr = newParam;

/ *从缓冲区检索数据* /

newParam + =(len + 9); / *移动标题的长度+ 9个字节* /

fileLocationLength [0] = newParam [0]; / *读取缓冲区的长度

fileLocationLength [1] = newParam [1]; / *前两个字节与我们相关..* /

fileLocationLength [2] = 0;

fileLocationLength [3] = 0;

fileLocationLengthASCII =(short *)(&fileLocationLength[0]); / * cast this to a short *以确保我们只读取两个字节* /

newParam + = 2; / *将流中的指针移动到实际字符串的开头* /

for(i = 0,j = 0; i<= * fileLocationLengthASCII; ++ i)

        if(!memcmp(newParam,“\ r \ n”,1)){/ *将新的字符串复制到一个叫做info*

            memcpy(info [j],newParam [i],1); / *仅复制ASCII字符和无空值* /

            ++j;

}}

 

/ *我们现在有一个字符串,URL,这是我们下一次调用所需要的值。 * /

char * URL = strcat(“URL = http://207.86.104.1”,info);

web_url(“Response_1.dat”,

URL,/ *此字符串现在保存相关值*/

“RecContentType = application / octet-stream”,

“SupportFrames = 0”,

LAST);

lr_eval_string_ext_free(newParamAdr);

相关文章
相关标签/搜索