为LoadRunner写一个lr_save_float函数
LoadRunner中有lr_save_int() 和lr_save_string() 函数,但是没有保存浮点数到变量的lr_save_float函数。《lr_save_float() function for LoadRunner》这篇文章介绍了如何写一个这样的函数:
http://ptfrontline.wordpress.com/2010/01/27/lr_save_float-function-for-loadrunner/
void lr_save_float(const float value, const char *param, const int decimals)
// ----------------------------------------------------------------------------
// Saves a float into a lr variable, much like lr_save_int() saves an integer
//
// Parameters:
// value Float value to store
// param Loadrunner variable name
// decimals Number of decimals in the result string
//
// Returns:
// N/A
//
// Example:
// lr_save_float(123.456, "myVar", 2); // myVar = 123.46 (includes rounding)
//
// ----------------------------------------------------------------------------
{
char buf[64]; // if more>63 digits -> your problem <IMG class="wp-smiley" alt=:) src="http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif">
char formatbuf[16]; // 16 chars should be adequate
sprintf( formatbuf, "%%.%df", decimals); // Build the "%?.f" format string
sprintf( buf, formatbuf, value); // sprintf the value
lr_save_string( buf, param); // store in variable
}
使用例子如下:
#include "lr_save_float.h"
vuser_init()
{
lr_save_float(123.456, "myVar", 2);
lr_output_message(lr_eval_string("{myVar}"));
return 0;
}
为LoadRunner写一个lr_save_float函数的更多相关文章
- 请写一个php函数,可以接受任意数量的参数
请写一个php函数,可以接受任意数量的参数 这是一道面试题.怎么写这个函数呢? function fun(......) { } ----------------------------------- ...
- 自己写一个strcmp函数(C++)
题目说明: 写一个函数,实现两个字符串的比较.即自己写一个strcmp函数,函数原型为int strcmp( char * p1, char * p2); 设p1指向字符串s1,p2指向字符串s2.要 ...
- 写一个PHP函数,实现扫描并打印出指定目录下(含子目录)的所有jpg文件名
写一个PHP函数,实现扫描并打印出指定目录下(含子目录)的所有jpg文件名 <?php $dir = "E:\照片\\";//打印文件夹中所有jpg文件 function p ...
- 依据ECMA规范,手写一个bind函数
Function.prototype.bind 函数,参见ECMA规范地址 如题,这次来实现一个boundFunction函数,不挂载在Function.prototype上,而是一个单独声明的函数. ...
- JavaScript 自己写一个 replaceAll() 函数
JavaScript 的 replace() 方法可以在字符串中用一些字符替换另一些字符,或替换一个与正则表达式匹配的子串. 但是,只输入字符串的话,仅替换第一个字符,当然也可以用正则表达式来进行 ...
- 自己写一个swap函数交换任意两个相同类型元素的值 对空指针的使用 字节大小的判断(二)了解原理
验证的代码: #include <stdio.h> int main(){ char c = 'z'; ) + (c << ) + () + 'a'; printf(" ...
- 写一个trim函数,兼容IE firefox chrome(正则)
因为在获取输入框内容时,常常trim下多余的空格.而IE部分低端浏览器里的JavaScript版本不内置trim()这个清楚空格函数,而流行的浏览器里都兼容了,比如chrome,FF等.为了不让IE下 ...
- 用1、2、2、3、4、5这六个数字,用java写一个main函数,打印出所有不同的排列,如:512234、412345等,要求:"4"不能在第三位,"3"与"5"不能相连。
最近在看算法,看到这个题,觉得挺经典的,收起. 分析: 1 .把问题归结为图结构的遍历问题.实际上6个数字就是六个结点,把六个结点连接成无向连通图,对于每一个结点求这个图形的遍历路径,所有结点的遍历路 ...
- 请写一个C函数,判断处理器是大端存储还是小端存储,若处理器是Big_endian的,则返回0;若是Little_endian的,则返回1
[解答] int checkCPU() { { union w { int a; char b; }c; c.a=1; return (c.b==1); } } [剖析] 嵌入式系统开发者应该对Lit ...
随机推荐
- LoggerAspect
package nc.oss.utils; import java.util.Date; import nc.bs.framework.common.InvocationInfoProxy; impo ...
- 【tomcat】获取访问者真实IP
1.直接访问tomcat的情况 通过下面这段代码可以获取: String ip = request.getHeader("x-forwarded-for"); if(ip == n ...
- UGUI的优点新UI系统二 直观、易于使用
UGUI的优点新UI系统二 直观.易于使用 对于UI控件,开发者可以直接使用鼠标在Scene视图里编辑它们的大小.位置和旋转角度,而无需编写任何代码,以Button为例,如图1-3.图1-4和图1 ...
- [ARC057D]全域木
题意:求有多少个边权为$1\cdots\frac{n(n-1)}2$的完全图的最小生成树的边权为$a_{1\cdots n-1}$ 啊啊啊我tm真的是什么都不会啊 考虑kruskal的过程:每次选取跨 ...
- 【最大流Dinic模板】HDU1532&POJ1273-Drainage Ditches(16/3/6更正)
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #inc ...
- pymysql与mysql各功能
pymysql # 增删改操作 import pymysql client=pymysql.connect( host='127.0.0.1', port=3306, user='root', pas ...
- oracle数据库,mybatis批量insert,缺失values字段
报错:### Error updating database. Cause: java.sql.SQLException: ORA-00926: 缺失 VALUES 关键字### The error ...
- Problem E: 12306
#include <stdio.h> struct student{ int n; int m;}; int main(void) { int T; int k,g,i,j; ],max; ...
- (转)DLL中导出函数的两种方式(dllexport与.def文件)
DLL中导出函数的两种方式(dllexport与.def文件)http://www.cnblogs.com/enterBeijingThreetimes/archive/2010/08/04/1792 ...
- friend ---- public and private
I mean the difference between: class A{public: friend class B;};and class A{private: //or nothing as ...