거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Telegram에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
라이브러리

FileUnlimited - MetaTrader 5용 라이브러리

조회수:
5519
평가:
(30)
게시됨:
2015.01.28 15:43
업데이트됨:
2016.11.22 07:32
\MQL5\Include\TheXpert\ \MQL5\Libraries\TheXpert\ \MQL5\Scripts\
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

Library for working with files using WinAPI without location limitations.

At present time the read-only mode is implemented. The library will be updated.

  • FileUnlimited.mqh, FileUnlimitedConstants.mqh, and StringUtils.mqh must be copied to the terminal_data_folder\MQL5\Include\TheXpert;
  • ConstFileUnlimited.mqh library must be copied to the terminal_data_folder\MQL5\Libraries\TheXpert;
  • FileUnlimitedTest.mq5 script must be copied to the terminal_data_folder\MQL5\Scripts.

I tried to make class usage as simple as possible.

Example of application (the script):

#include <TheXpert/FileUnlimited.mqh>
#include <TheXpert/StringUtils.mqh>

#define CP_UTF16 1200

void OnStart()
{
   string name = "TheXpert\\Test.txt";
   string path = TerminalInfoString(TERMINAL_DATA_PATH) + "\\MQL5\\Files\\" + name;
   
   int hFile = FileOpen(name, FILE_WRITE | FILE_TXT, ' ', CP_UTF16);
   if (hFile == INVALID_HANDLE)
   {
      Print("File not opened.");
      return;
   }
   
   bool writeBool = false, readBool = true;
   long writeLong = -4369549, readLong = 0;
   double writeDouble = -4369549.245, readDouble = 0;
   datetime writeDatetime = 2596824987, readDatetime = 0;
   color writeColor = Blue, readColor = White;
   string writeString = "2r4i6bf4wb9tb69vw", readString = "";
   
   FileWrite(hFile, writeBool);
   FileWrite(hFile, writeLong);
   FileWrite(hFile, writeDouble);
   FileWrite(hFile, writeDatetime);
   FileWrite(hFile, writeColor);
   FileWrite(hFile, writeString);

   FileClose(hFile);
   
   // ---------------------------------------------
   // from here the library for reading is used.
   // ---------------------------------------------
   ConstFile* file = OpenConstFile(path);
   if (CheckPointer(file) != POINTER_INVALID)
   {
      file.Read(readBool);
      Print("readBool = ", readBool);

      file.Read(readLong);
      Print("readLong = ", readLong);

      file.Read(readDouble);
      Print("readDouble = ", readDouble);

      file.Read(readDatetime);
      Print("readDatetime = ", readDatetime);

      file.Read(readColor);
      Print("readColor = ", readColor);

      file.Read(readString);
      Print("readString = ", readString);
      
      delete file;
   }
   else
   {
      Print("Failed to open ConstFile at path -- ", path);
   }
}

The library operates with Unicode files only, that's why we have CP_UTF16 code page (for some reason it is not available in language constants).

Please notify about all detected errors in comments or this thread.

Comments, suggestions, and constructive criticism are welcome.

Let's make something useful for everyone!

MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/386

Mutex - WinAPI Mutex - WinAPI

Synchronize ОС/EA/MT processes etc. Any self-made DLLs are not needed now.

Margin Calculation Margin Calculation

Library for calculation of a margin required for opening a position in MetaТrader 5.

dt_FFT dt_FFT

Library of fast Fourier transformation functions (FFT).

CHashArrayStringString CHashArrayStringString

Example of implementation of lines hash array with a string key.