Bug in FileWriteString (MQL4) - page 2 12 New comment Ziheng Zhuang 2021.05.26 18:11 #11 Malik Arykov: everything works as it should ;-) uint FileWriteString( int file_handle, // File handle const string text_string, // string to write int length=-1 // number of symbols ); Yes, use the length of symbols in text as the third parameter, there is no bug. In some sisuations,we need to create file with a fixed bytes,therefore we have to pass a fixed number for the third paremeter. Questions from Beginners MQL5 Over value in indicator Why when I lunch Malik Arykov 2021.05.26 20:50 #12 Ziheng Zhuang: Yes, use the length of symbols in text as the third parameter, there is no bug. In some sisuations,we need to create file with a fixed bytes,therefore we have to pass a fixed number for the third paremeter. int len = 64; string str = "1234567"; string tail; // string filled with zeros StringInit(tail, len - StringLen(str)); FileWriteString(handle, str + tail, len); content must match the length or vise versa ;-) Mohammad Hossein Sadeghi 2021.05.27 10:10 #13 Malik Arykov: content must match the length or vise versa ;-) This is a work-around, but the built-in function 'FileWriteString' has an option to do it if the parameter is greater than the length of the string, it is poorly documented, and the result is a different from MQL4 to MQL5. StringConcatenate error is there a bug [Documentation error?] Indexing after Malik Arykov 2021.05.27 11:30 #14 But... This work-around solves the problem (fixes the bug ;-) Mohammad Hossein Sadeghi 2021.05.27 14:24 #15 Malik Arykov: But... This work-around solves the problem (fixes the bug ;-) It kills the bug ;D 12 New comment
everything works as it should ;-)
Yes, use the length of symbols in text as the third parameter, there is no bug.
In some sisuations,we need to create file with a fixed bytes,therefore we have to pass a fixed number for the third paremeter.
Yes, use the length of symbols in text as the third parameter, there is no bug.
In some sisuations,we need to create file with a fixed bytes,therefore we have to pass a fixed number for the third paremeter.
content must match the length or vise versa ;-)
content must match the length or vise versa ;-)
This is a work-around, but the built-in function 'FileWriteString' has an option to do it if the parameter is greater than the length of the string, it is poorly documented, and the result is a different from MQL4 to MQL5.
But... This work-around solves the problem (fixes the bug ;-)
It kills the bug ;D