There are frequent questions in this forum (e.g. 'Difficulty using FileReadString on file opened outside /experts/files') about reading and writing files anywhere on the hard disk, but there only seems to be one published library for doing so, and it's fairly limited: 'File Operations without Limitations'
The attached include-file uses the CreateFileA(), ReadFile() etc family of Windows API functions rather than _lcreat(), lread() etc. Differences/improvements from https://www.mql5.com/en/code/8314 are as follows:
The attached include-file [...]
...and the attached file is a test script for the above include-file.
jjc - you're Da Man!
Presently, I do not have requirement but will download and save 'for that rainy day' and the learning about api i/f is always of interest too!
Many thank you's offered :O)
edit: once again having dl'd into ed, I'm struck by your code. Has always proved to be a pleasure to read. Formatting, comments and concise too.
Heaven knows is bad enough coding let alone maintenance - which in my case means after first clean compile, yet your src is agreeable and this is massively important and severely underrated by many...
are you also a 'gun for hire'?
I ask cuz my distinct brain dead feelings seem more obvious these days... like for the last 10yrs :o)
Er, no. Leaving the code aside, there are at least two "bugs" just in the comments. The notes on OpenExistingFileForReading() have a nonsensical reference to appending and overwriting, caused by pasting the text from the previous function. And the notes in the test script refer to writing CRLF-terminated lines despite the fact that I changed the code to provide a more useful example of pipe-terminated blocks.
Up to a point. See www.mtintelligence.com/about.aspx
As MT4 upgrate to build 600, I can not use _lcreat(), lread() etc.
Please support, Thanks!
according to MSDN - Microsoft:
This function is provided for compatibility with 16-bit versions of Windows. New applications should use the CreateFile function.
B.T.W. in the new MT4 u have to use CreateFileW instead of CreateFileA
the newest change is CreateFileA()---CreateFileW() DeleteFileA()---DeleteFileW() delete StringSplit() function (the new mt4 600+ Contains this function)
and it's good to use from Excel2txt2mql or mql2txt2mql
and It should be noted that the "xxx.txt" must be unicode encoding
To add comments, please log in or register