Tuesday, 8 April 2014

Load Runner code for writing data in notepad


Below code is to save the Vendor numbers to a notepad.
(put it in vuserinit starting after Header)
//Path for saving the notepad file, the file name is "MatDocument.txt"

#define filename "C:\\Documents and Settings\\ravi\\Desktop\\MatDocument.txt"

f_Write(char *str1)
{
          long a;
          a = fopen(filename,"a+");
          if (a==NULL)
           {
             return -1;
          }
          else
          {
             fprintf(a,"Material Document Number is %s\n",str1);
             fclose(a);
          }
}



Save a parameter in notepad file:

This code will create a notepad file and save the parameter into it.


long fd;
web_reg_save_param("saveID","LB=---","RB=---","ORD=1",Last); //Capture the value in "saveID"
fd=fopen( "C:\\NotepadName.txt","a" ); //Path of notepad
fprintf( fd,"%s\n",lr_eval_string("{saveID"})); //It will print the data and go to next line
fclose( fd ); // It will close notepad.

No comments:

Post a Comment