FileWriteArray has problem in bulid 600. no problem in build 509.help me.

 
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

int start()
  {
//----
   string arrtest[4];
   arrtest[0] = 1;
   arrtest[1] = 1;
   arrtest[2] = 1;
   arrtest[3] = 1;
   
   int handle=FileOpen("1.txt",FILE_READ|FILE_WRITE|FILE_BIN);
   if(handle!=0)
     {
      FileWriteArray(handle,arrtest,0,200);
      FileClose(handle);
     }
   else
      Print("Failed to open the file, error ",GetLastError());
//----
   return(0);
  }

the same code,at bulid 600, 1.txt is blank.

1.txt

at bulid 509, 1.txt is not blank, the content is 1 1 1 1.

2.txt

why? somebody help me.

 

Documentation is all over the place but local help file says same as for mql5:

"The function writes arrays of any type except for string to a BIN file (can be an array of structures not containing strings or dynamic arrays)."

Online page has not been updated and still says:

Arrays of string type will be written by strings, the line end character "\r\n" to be added at each string automatically."

Another one to add to my mql migration notes! Like the new features but very unimpressed with the way this language change has been handled by MQ!


PS I guess just replace it with a loop. and ask MQ to force a compiler warning?

 
ydrol:

Documentation is all over the place but local help file says same as for mql5:

Online page has not been updated and still says:

Another one to add to my mql migration notes! Like the new features but very unimpressed with the way this language change has been handled by MQ!


sorry,I still don't understand,how to fix the code, than can work at bulid 600?
 
ydrol:

PS I guess just replace it with a loop . and ask MQ to force a compiler warning?

Just added the above ... write the array elements in a loop calling FileWriteString ?
 
ydrol: Documentation is all over the place but local help file says same as for mql5: Online page has not been updated and still says: Another one to add to my mql migration notes! Like the new features but very unimpressed with the way this language change has been handled by MQ!
  • I believe allot of people would support you when it comes to the Online-Documentations or Lack-There-Of.
  • MQ, If you're reading, Please replace the Old-Web-Docs with the New-Web-Docs. Thank-You.
 
Or open the file as FILE_TXT (further down the page). So then FileWriteArray should work...
 
ydrol:
Or open the file as FILE_TXT (further down the page). So then FileWriteArray should work...

thank your very much. you are right.
 
ubzen:
  • MQ, If you're reading, Please replace the Old-Web-Docs with the New-Web-Docs. Thank-You.



No don't do that. We still need the old mql4 docs too!
 
euclid:

No don't do that. We still need the old mql4 docs too!
I agree. The web docs for MQL4 (for build 509 and earlier) should continue to be accessible on mql4.com because, for example, some are still going to need to reference back to them for EAs/scripts built on the older MQL4 and, also, there are lots of relevant posts on this forum that link to those web docs.
 
euclid: No don't do that. We still need the old mql4 docs too!
  • Yeah .. I agree with that too. Given that they update the mql4 docs to reflect their actual current purpose.
  • Mql4+ just needs an online-documentation so that the forum support could reference them as well.
  • If they can also add a revision list... like what changed and when it changed that'll be awesome.
  • By replace, I meant update all the documentations and put them online. I should have been more clear.
  • I doubt that all of this is going to happen ... but we can always cross our fingers.
 
ubzen:
  • Yeah .. I agree with that too. Given that they update the mql4 docs to reflect their actual current purpose.
  • Mql4+ just needs an online-documentation so that the forum support could reference them as well.
  • If they can also add a revision list... like what changed and when it changed that'll be awesome.
  • By replace, I meant update all the documentations and put them online. I should have been more clear.
  • I doubt that all of this is going to happen ... but we can always cross our fingers.
It was stated in public that the updated Documentation would show the old and new and change log . . .
Reason: