Download MetaTrader 5

Please Help In Opening The File

To add comments, please log in or register
PFX_1
9
PFX_1  

Hi ,

After Moving to MT4 ver 600 and more , My Last code for opening the file met the problem.

You Can see the code and the Error Message : 

Also I'm running in wiondows8.1 X32 . Can anyone suggest a solution

 

void OnStart()

  {

//---

     int iErr=0;

   string terminal_data_path=TerminalInfoString(TERMINAL_DATA_PATH);

   string filename=terminal_data_path+"\\MQL4\\Files\\"+"Text.txt";

   int filehandle=FileOpen(filename,FILE_READ);

   if(filehandle<0) 

   { 

     iErr=GetLastError();

     Alert("Error code In File Opening is  Description : "+

         ErrorDescription(iErr)+ " : No:  "+ IntegerToString(iErr) );

   }

   else {

         Alert("Successful File Opening");

         FileClose(filehandle);

        }

  } 

Files:
Drazen Penic
2698
Drazen Penic  

You don't need folder to write to the "Files" folder, it is default for the FileOpen() function.

Use this:

string filename="Text.txt";

 

And please, use "SRC" option when you enter source code in the post. 

PFX_1
9
PFX_1  

Thank You I solved it by using the following

 

#import "kernel32.dll" 

 int ReadFile(int, uchar&[], int, int&[], int); 

 

that sounds good. 

To add comments, please log in or register