Quantcast
Channel: LoadRunner Practitioners Forum topics
Viewing all articles
Browse latest Browse all 3978

C logic for writing output to CSV file in different columns

$
0
0

Hi C/LoadRunner experts,

 

I am looking for some on C logic which would meet my requirement. I made an attempt but I am not fully successfully. When wiritng output to csv file, the value is replacing the existing header values. 

Here is my code

 

     int i;
    char length[100];
    char * filename = "C:\\test.csv";
    long file;
                
    if ((file = fopen(filename, "w+")) == NULL)     

    {
        lr_output_message("File do not exists %s", filename);
        return -1;
    }
      sprintf(length, "\n%s", lr_eval_string("CS_{Unique}"));
    
    i = fwrite(&length, sizeof(length), 1, file);
    if(i>0)
    {
        lr_output_message("Sucessfully wrote file to %d", i);
        fclose(file);
    }

 

Now the output is just as follows in CSV file ( replaced the headers)

 

CS_1

 

but  this is what I am expecting for

 

BeneficiaryName  BeneficiaryID

CS_1                            0001

 

 

Thanks in advance,

Mani

 


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>