Download MetaTrader 5
To add comments, please log in or register
How to choose the most appropriate signal and subscribe to it in no time
xuzhe
100
xuzhe 2014.06.10 10:40 

i do have a test file in Files Folder

 

 

 

and the script code is:

#include <Files\FileTxt.mqh>

CFileTxt FileTxt;

void OnStart()
{
//---
   string terminal_data_path=TerminalInfoString(TERMINAL_DATA_PATH);
   string filename=terminal_data_path+"\\MQL4\\Files\\"+"share.txt";
   
   Print(filename);
   
   //FileTxt.Open(filename,FILE_SHARE_READ|FILE_SHARE_WRITE);
   
   Print(FileTxt.IsExist(filename));   
}

 always output:

 

 

this file really exists,why it always output false. 

qjol
3243
qjol 2014.06.10 11:36  

i don't see a directory with the name "Users"




xuzhe
100
xuzhe 2014.06.10 11:47  

because it's a OS with Chinese language 

 

用户 is equals to USers 

 

 

qjol
3243
qjol 2014.06.10 12:04  

the computer doesn't have a human mind and he doesn't know that 用户 is equals to USers

report to Servicedesk, See the article MQL5.community - User Memo => 5. Service Desk

xuzhe
100
xuzhe 2014.06.10 12:09  
qjol:

the computer doesn't have a human mind and he doesn't know that 用户 is equals to USers

report to Servicedesk, See the article MQL5.community - User Memo => 5. Service Desk


用户 is only a display way to show "User"

 

the computer can find file with  "C:\Users\xuzhe\AppData\Roaming\MetaQuotes\Terminal\014058E9AD9F88D0B7755299A7BB6853\MQL4\Files"

 

i can sure my dir is right,but the script can not run normally.

 

you can try on your own computer. 

 

i use the TERMINAL_DATA_PATH to make sure the dir is right

 

and i create this text file by using MetaEditor.

 

i use the right dir ,but CFile Class does not work 

whroeder1
13656
whroeder1 2014.06.10 12:39  
xuzhe: this file really exists,why it always output false.
string filename=terminal_data_path+"\\MQL4\\Files\\"+"share.txt";
i use the TERMINAL_DATA_PATH to make sure the dir is right
  1. Because the file "c:\users...nnn\MQL4\Files\\MQL4\Files\c:\users...nnn\MQL4\Files\\MQL4\Files\share.txt" does NOT exist.
  2. That IS your problem.
  3. FileOpen - MQL4 Documentation say:
    The file is opened in the folder of the client terminal in the subfolder MQL4\files (or Tester\Files in case of testing)
  4. The dir is right by definition. Just use
      string filename="share.txt";
xuzhe
100
xuzhe 2014.06.10 13:32  
thank you, i will try it
/
To add comments, please log in or register