Highlighted
Absent Member.
Absent Member.
138 views

How to create an external text/data file in LR

Does someone have experience in creating/reading/writing .txt .dat files in Loadrunner.
I know this can be done by a simple C code, but LR does not recognize , so all functions related to Input-Output does not work.
0 Likes
2 Replies
Highlighted
Respected Contributor.
Respected Contributor.

Re: How to create an external text/data file in LR

yes it is possible you can google/bing the code from the library to include it into you include.h, I can send a code that I have developed specifically for that as well as I think there are lot of samples available in KB.
0 Likes
Highlighted
Respected Contributor.
Respected Contributor.

Re: How to create an external text/data file in LR

as long as you have web_api.h you can do it like so:

char *filename = "c:\\logfile.txt";
long file;
vuser_init()
{
file =fopen(filename, "w+");

return 0;
}


Action()
{


char *userid;
char *fname;


lr_save_string(fname,"fname");
fprintf(file, "%s\n",(lr_eval_string("{fname}")));


return 0;
}
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.