path file problem

 

hi guy  i have in my terminal \MQL4\Files\dataCOT\Finance\forexsymbol.csv  file  csv  i  try to load  with this script  but  return me error in path not exist a file o_O how  is  possible ?


int start()
  {

   string terminal_data_path=TerminalInfoString(TERMINAL_DATA_PATH);
   string filename=terminal_data_path+"\\MQL4\\Files\\dataCOT\\Finance\\forexsymbol.csv";  //

   string line_read[2][416]; //assign array of string that will store 2 columns 416 rows of csv data
   int row=0,col=0; //column and row pointer for the array
   int  handle=FileOpen(filename,FILE_CSV|FILE_READ,";"); //comma delimiter

   if(handle>0)
     {
      while(True) //loop through each cell
        {
         string temp = FileReadString(handle); //read csv cell
         if(FileIsEnding(handle))
            break; //FileIsEnding = End of File
         line_read[col][row]=temp; //save reading result to array
         if(FileIsLineEnding(handle)) //FileIsLineEnding = End of Line
           {
            col = 0; //reset col = 0 for the next row
            row++; //next row
           }
         else
           {
            col++; //next col of the same row
           }
        }
      FileClose(handle);
     }
   else
     {
      Comment("File "+filename+" not found, the last error is ", GetLastError());
     }

   return 0 ;
  }
thankz at all 
 
faustf: i have in my terminal \MQL4\Files\dataCOT\Finance\forexsymbol.csv 
   string terminal_data_path=TerminalInfoString(TERMINAL_DATA_PATH);
   string filename=terminal_data_path+"\\MQL4\\Files\\dataCOT\\Finance\\forexsymbol.csv";  //

Your code is trying to open "C:\users\«user»\appdata\roaming\Metaquotes\Terminal\«HHHHHHHHH»\MQL4\Files\C:\users\«user»\appdata\roaming\Metaquotes\Terminal\«HHHHHHHHH»\MQL4\Files\ dataCOT\Finance\forexsymbol.csv" which does not exist.

Just open "dataCOT\Finance\forexsymbol.com" and Perhaps you should read the manual.
How To Ask Questions The Smart Way. 2004
     How To Interpret Answers.
          RTFM and STFW: How To Tell You've Seriously Screwed Up.

 
 but if i print filename  return me  a correct path  o_O
 
Irrevalent. that isn't what you are trying to open. Perhaps you should read the manual; starting with the second paragraph of File Functions - MQL4 Reference
How To Ask Questions The Smart Way. 2004
     How To Interpret Answers.
          RTFM and STFW: How To Tell You've Seriously Screwed Up.
 

i try to undersuntnd sorry

metatrader  have a sandbox  ,by default write  and read file in MQL/File , i creted inside 2  folder datacot/finance/  and inside of finance i put a file forexsymbol.csv

now  i try to read

i write in this mode

 string filename="\\dataCOT\\Finance\\forexsymbol.csv";  //


   string line_read[2][416]; //assign array of string that will store 2 columns 416 rows of csv data
   int row=0,col=0; //column and row pointer for the array
   int  handle=FileOpen(filename,FILE_CSV|FILE_READ,";"); //comma delimiter

   if(handle>0)
     {
      while(True) //loop through each cell
        {
         string temp = FileReadString(handle); //read csv cell
         if(FileIsEnding(handle))
            break; //FileIsEnding = End of File
         line_read[col][row]=temp; //save reading result to array
         if(FileIsLineEnding(handle)) //FileIsLineEnding = End of Line
           {
            col = 0; //reset col = 0 for the next row
            row++; //next row
           }
         else
           {
            col++; //next col of the same row
           }
        }
      FileClose(handle);
     }
   else
     {
      Comment("File "+filename+" not found, the last error is ", GetLastError());
     }

but also in this mode nt work ???

why ? always 5002  error