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

How to read content from a file and storing it in a string variable?

$
0
0

I want to read the content of a file and store it in a string and use it as part of my script.

Right now i am doing it with the below code:

char Content[2936];

InPutFile=fopen(Filename,"r");
fread(Content,sizeof(char),2936, InPutFile);    
fclose(InPutFile);

I have manually checked the size of the file from properties and used the same (2936), which i want to avoid.

Is there any better way to do it? Especially when we don't know the size of the file.

 

 

 


Viewing all articles
Browse latest Browse all 3978


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