char *filename = "c:\\myfilename.txt";
long file_stream;
vuser_init()
{
if ((file_stream = fopen(filename, "a+")) == NULL) //open file in append mode
{
lr_error_message ("Cannot open %s", filename);
return -1;
}
fprintf (file_stream, "%s\n", lr_eval_string("THE PARAMETER IS :{Parameter}")); //Parameter is parameter name to be written in a file
Return 0;
}
vuser_end()
{
fclose(file_stream);//dont forget to close file_stream in vuser_end scetion
return 0;
}
Nice piece of code, exactly what i needed. Thanks!
ReplyDeleteHi,
ReplyDeleteI have used the same logic in my script to write parameter values into file. But I am getting C interpreter error message in Vuser_end at end of Iteraion. Can you please help me on this.
Thank you
Mohan
This comment has been removed by the author.
ReplyDeleteHi, I want to save some value in to a note pad during a load test with HP PC. How can I do that when i dont have the access to LGs
ReplyDeleteHi All,
ReplyDeleteAs part of my requirement, I need to read the values from the DB and then write the data to a *.dat or *.txt file (within the Init section) and use the same file as a parameter in the same script instead of using the lr_db_getvalue since this carries an overhead on the CPU/memory consumption on the lg machine and also because we will not be able to allocate block if we use DB to get the values as ther could be a situation wherein the sane data is picked up by different users during the test. Any suggestion how to overcome this?