Download MetaTrader 5
To add comments, please log in or register
Added support for the Spanish language. Come and check it out!
yumazaki
98
yumazaki 2014.02.10 06:08 
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 2014.02.10 06:21  

if test.txt content is

print is

ydrol
595
ydrol 2014.02.10 07:54  

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 2014.04.04 17:13  

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