Download MetaTrader 5

What's wrong with FileReadArray in build 600. but build 509 is no problem

To add comments, please log in or register
yumazaki
98
yumazaki  
int init()
  {
//---
   string arr[3][2];
   arr[0][0] = "";
   arr[0][1] = "";
   arr[1][0] = "";
   arr[1][1] = "";
   arr[2][0] = "";
   arr[2][1] = "";
   
   int handle = FileOpen("test.txt", FILE_TXT|FILE_READ);
   if(handle>0) {
      FileReadArray(handle, arr, 0, WHOLE_ARRAY);
      FileClose(handle);
      
      Print(arr[0][0]);
      Print(arr[0][1]);
      
      Print(arr[1][0]);
      Print(arr[1][1]);
      
      Print(arr[2][0]);
      Print(arr[2][1]);
   }
   return(0);
  }

test.txt content is

Print is

What's wrong with FileReadArray in build 600. build 509 is no problem

why?someboy help me.

yumazaki
98
yumazaki  

if test.txt content is

print is

ydrol
593
ydrol  

It looks like another bug in FileReadArray (sigh!). I've just verified on build 604 it is still a bug.

You should report to service desk (need to create mql5 login) and in the mean time use arr[i][j]=FileReadString(handle) in a loop!

MQ don't seem to have any kind of extensive test suite in place for this new MQL4/5 language? A little disconcerting for developers!

dudess
17
dudess  

Has anyone heard anything about fixes on this bug?

I'm on 610 and it is still only reading 12 chars per line and it is driving me up the wall! I really want to stick with FileReadArray because it is way faster than using FileReadString in a loop.

(Totally agree with ydrol! Seriously... Have the MQ developers ever heard of something called unit testing? Ironically I noticed this issue because their bug is currently breaking my own unit tests!!!)

To add comments, please log in or register