Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

FileUnlimited - MetaTrader 5 Library | Trading Script Download - MT4/MT5 Resources

author EAcpu | 2 reads | 0 comments |

FileUnlimited - library for MetaTrader 5

FileUnlimited - library for MetaTrader 5

Library for working with files using WinAPI regardless of location.

What is currently implemented is read-only mode. The library will be updated.

I've tried to make using the class as simple as possible.

Application example (script):

 #include
#include

#define CP_UTF16 1200

blank start ()
{
String name = "TheXpert\\Test.txt" ;
String path = terminal information string ( terminal data path ) + "\\MQL5\\File\\" + name;
  
Integer h file = file open (name, file write | file_TXT , '' , CP_UTF16);
if (h file == INVALID_HANDLE )
  {
print ( "The file is not open." );
return ;
  }
  
boolean writes boolean= false , reads boolean= true ;
Long long write = - 4369549 , long read = 0 ;
Double, write double = - 4369549.245 , read double = 0 ;
Date and time written date and time = 2596824987 , read date and time = 0 ;
color write color = blue, read color = white;
string write string = "2r4i6bf4wb9tb69vw" , read string = "" ;
  
File write (hFile, writeBool);
File write (hFile, writeLong);
File write (hFile, writeDouble);
File write (hFile, writeDatetime);
filewrite (hfile,writecolor);
File write (hFile, writeString);

file close (h file);
  
//---------------------------------------------------------------- // Start using the reading library from here. //------------------------------------------------------------- ConstFile* file = OpenConstFile(path);
if ( check pointer (file) != POINTER_INVALID )
  {
      File.Read(readBool);
print ( "readboolean=" , readboolean);

      File.Read(readLong);
print ( "read_long=" , long_read);

      File.Read(readDouble);
print ( "readdouble=" , readdouble);

      File.Read(readDatetime);
print ( "read date and time =" , read date and time);

      File.Read(readColor);
print ( "readcolor=" , readcolor);

      File.Read(readString);
print ( "read string=" , read string);
 
Delete files;
  }
other {
print ( "Cannot open ConstFile located at path -- " , path);
  }
}

The library only runs with Unicode files, that's why we have the CP_UTF16 codepage (for some reason it's not available in the language constants).

Please notify all detected bugs in the comments or comments of this thread .

Comments, suggestions and constructive criticism are welcome.

Let's make something useful for everyone!


Attachment download

📎 fileunlimited.mqh (0.44 KB)

📎 fileunlimitedconstants.mqh (10.74 KB)

📎 stringutils.mqh (0.61 KB)

📎 constfileunlimited.mq5 (12.87 KB)

📎 fileunlimitedtest.mq5 (1.84 KB)

Source: MQL5 #386

Verification code Refresh