FileReadString in binary file problem ? [FIXED] - page 2

 
Alain Verleyen:
Just noticed this bug is still present in MT5 Build 2190. I will report it. 

Hi, I noticed that FileReadString has still a limitation (MT5 Build 2622). Writing a string to .bin seems without limitation. But when I try to read a bin file with 16384 characters, then it won't read the string. (File with 16383 characters works). 

int OnInit()
  {
//---
   string str1=readBinFile("16383.bin");
   string str2=readBinFile("16384.bin");
  
   Print("StringLength 16383.bin: ",StringLen(str1),"\n",
         "StringLength 16384.bin: ",StringLen(str2));
//---
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
string readBinFile(const string fName) 

{
   int filehandle  = FileOpen(fName,FILE_READ|FILE_SHARE_READ|FILE_BIN|FILE_COMMON);  
   if (filehandle == INVALID_HANDLE)
    { 
      Alert(fName," FileOpen in COMMON FAILED: ",_LastError); FileClose(filehandle); 
    }   
   string f = FileReadString(filehandle,(int)FileSize(filehandle));
   
   FileClose(filehandle);
  
   return(f);

output:

Is that a bug, or an actual limitation for some reason?

Thanks for any help in advance.

Cheers, Julian.

Files:
bin_files.zip  3 kb