File Read problem

 

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. 

 

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




 

because it's a OS with Chinese language 

 

用户 is equals to USers 

 

 

 

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

 
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 

 
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";
 
thank you, i will try it