how to read the whole string of csv file?

 

Hi all,

I have a csv file with 2 variable, equity and time stamp as shown below

10494,2016.05.06 23:55

 

When i try to read the content of the csv file using the script below, it gave me only the equity (10494) which is the "text" variable 

How do i read the whole string which is 10494,2016.05.06 23:55 ?

 

Thanks 

############## 

void ReadCurrentEquityTimeFromFile(){

   int filehandle=0;

   string text;

   

   for (int i=0;i<5;i++){

       filehandle=FileOpen(csvfilename,FILE_READ|FILE_CSV,",");

       if(filehandle!=INVALID_HANDLE) break;

       Sleep(1000);

   }

     

   if(filehandle!=INVALID_HANDLE)

     {

     text = FileReadString(filehandle,0);

     }  

   FileFlush(filehandle);

   FileClose(filehandle);

 

}

 

I manage to resolve it by changing

filehandle=FileOpen(csvfilename,FILE_READ|FILE_CSV,",");

to 

filehandle=FileOpen(csvlastequityfilename,FILE_READ);

 
Alain Verleyen:

noted
 
bobo1974:
noted
Why dont you do what Alain suggest. It makes your code more "readable".
Reason: