LoadRunner读取文件并验证
checkprocess() { char command[1024]; int i, total = 0; char buffer[12], ch; char *filename = lr_eval_string("C:\\tasklist_{pTime}.txt"); long file_stream; //Run a system command to open up a DOS prompt and tasklist //Save it to a file sprintf(command, "tasklist /FI \"IMAGENAME eq MobileEngine.exe\" /FI \"STATUS eq running\" /FO TABLE /NH > %s", filename); system(command); // open file and check for errors opening it. if ((file_stream = fopen(filename, "r")) == NULL ) { lr_error_message("Cannot open %s", filename); return -1; } //read the file stream information - place in loop. for(i=0; (i<NUM_CHARS) && (feof(file_stream) == 0); i++) { ch = fgetc(file_stream); /* Read in the next character */ buffer[i] = ch; /* Place the new char at the end of the buffer */ } /* Add null to end the buffer converting it to a string */ buffer[i] = NULL; lr_output_message("First %d characters of file %s are \"%s\"", NUM_CHARS, filename, buffer); if (fclose(file_stream)){ lr_error_message("Error closing file %s", filename); }; // Now we either have something in the buffer or not. // We are looking for the string "MobileEngine" in this case // Either way, delete the temp file when done. if (strcmp(buffer, "\nMobileEngine") != 0) { lr_error_message("The process is not running. Aborting Script..."); sprintf(command, "DEL %s", filename ); // lr_error_message("%s", command); system(command); return -1; } else{ lr_output_message("The process is running. Continue..."); sprintf(command, "DEL %s", filename ); // lr_error_message("%s", command); system(command); }; return 0; }LoadRunner读取文件并验证的更多相关文章
- Loadrunner 读取文件
char buffer[1000]; long file_stream; char * filename = "d:\log.txt"; file_stream=fopen(fil ...
- 7 RandomAccessFile读取文件内容保存--简单例子(需要验证)
import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.*; /** * 读取动态产生的文件内容 */ publ ...
- LoadRunner 脚本学习 -- 读取文件内容
随便创建个txt文档 输入点内容,例如 读取文件内前N个字符: Action() { long myfile; ; ]; char *filename = "E:\\kkk.txt&quo ...
- java 正则表达式的应用:读取文件,获取其中的电话号码
1.正则表达式 正则表达式,又称正规表示法.常规表示法(英语:Regular Expression,在代码中常简写为regex.regexp或RE),计算机科学的一个概念.正则表达式使用单个字符串来描 ...
- LoadRunner脚本实例来验证参数化的取值
LoadRunner脚本实例来验证参数化的取值 SINM {3]!G0问题提出: 主要想试验下,在Controller中,多个用户,多次迭代中参数的取值.51Testing软件测试网(['H5f,d ...
- java 使用相对路径读取文件
java 使用相对路径读取文件 1.java project环境,使用java.io用相对路径读取文件的例子: *目录结构: DecisionTree |___src ...
- HTML5 文件域+FileReader 分段读取文件(五)
一.默认FileReader会分段读取File对象,这是分段大小不一定,并且一般会很大 HTML: <div class="container"> <!--文本文 ...
- HTML5 文件域+FileReader 读取文件并上传到服务器(三)
一.读取文件为blob并上传到服务器 HTML <div class="container"> <!--读取要上传的文件--> <input type ...
- HTML5 文件域+FileReader 读取文件(二)
一.读取文本文件内容,指定字符编码 <div class="container"> <!--文本文件验证--> <input type="f ...
随机推荐
- Gaby And Addition Gym - 101466A (初学字典树)
Gaby is a little baby who loves playing with numbers. Recently she has learned how to add 2 numbers ...
- kubernetes--应用程序健康检查
版权声明:本文属于原创,欢迎转载,转载请保留出处:http://blog.csdn.net/liyingke112 http://blog.csdn.net/liyingke112/article/d ...
- UVA 1649 Binomial coefficients
https://vjudge.net/problem/UVA-1649 题意: 输入m,求所有的C(n,k)=m m<=1e15 如果枚举n,那么C(n,k)先递增后递减 如果枚举k,那么C(n ...
- [SCOI2009]生日礼物
https://www.luogu.org/problem/show?pid=2564 题目描述 小西有一条很长的彩带,彩带上挂着各式各样的彩珠.已知彩珠有N个,分为K种.简单的说,可以将彩带考虑为x ...
- hdu4085 Peach Blossom Spring
Peach Blossom Spring http://acm.hdu.edu.cn/showproblem.php?pid=4085 Time Limit: 10000/5000 MS (Java/ ...
- 最大公倍数_Greatest Common Divisor
计算最大公倍数 Static int gcd( int a, int b) { int t; while( b>0) { t = b; b = a % b; a = t; } return a; ...
- mysql 数据库备份与还原,用户的创建与删除,用户的密码修改
1.备份数据库 要退出mysql rimideiMac-23:~ rimi$ mysqldump -u root -p pro >pro.sql ls 查看路径 2.恢复数据库 2.1直接 ...
- 【BZOJ】1486 [HNOI2009]最小圈
[算法]二分+spfa [题解]据说这个叫分数规划? 0-1分数规划 二分答案a,则对于任意的环有w/k≤a即w-ak≤0,若满足条件则a变小,否则a变大. 因为w=w1+w2+...+wk,所以变形 ...
- MongoDB 数据库(1)
数据库 MongoDB (芒果数据库) 数据存储阶段 文件管理阶段 (.txt .doc .xls) 优点 : 数据可以长期保存 可以存储大量的数据 使用简单 缺点 : 数据一致性差 数据查找修改不方 ...
- CPU架构及并发编程基础(一)
一.intel cpu发展计划tick-tock Tick-Tock是Intel发展微处理器芯片设计制造业务的一种战略模式.Intel指出,每一次处理器微架构的更新和每一次芯片制程的更新遵循“Tick ...