Download MetaTrader 5
To add comments, please log in or register
How to earn at MQL5.community? Come and find out!
LouK
143
LouK 2014.06.11 18:56 

I can read and write files OK in one terminal, but they appear to be filed relative to the terminal. I want to be able to read a common file from any terminal/account.

Can anyone show me in the 600 build how to file an absolute path or otherwise access a common file from other terminals/accounts? 

 

I've tried to open this path, which I copied and pasted from the file Properties, but MT won't open it:

   int fileHandle=FileOpen("C:\Program Files\Metatrader\MetaTrader - 082\TESTFOLDER\TESTFILE.txt",FILE_READ|FILE_WRITE|FILE_TXT);

 

 

Thanks! 

LouK
143
LouK 2014.06.11 20:29  
 I just figured out how to do it. For anyone with the same question, go with the MT path but add "FILE_COMMON" to your file handle flags when you write the file. This places the file in a shared folder making it accessible to other terminals.
whroeder1
13641
whroeder1 2014.06.11 21:05  
LouK:  int fileHandle=FileOpen("C:\Program Files\Metatrader\MetaTrader - 082\TESTFOLDER\TESTFILE.txt",FILE_READ|FILE_WRITE|FILE_TXT);
File Read problem - MQL4 forum
LouK
143
LouK 2014.06.11 23:11  
WHRoeder:
LouK:  int fileHandle=FileOpen("C:\Program Files\Metatrader\MetaTrader - 082\TESTFOLDER\TESTFILE.txt",FILE_READ|FILE_WRITE|FILE_TXT);
File Read problem - MQL4 forum


 But why deal with absolute paths when, as I said above, the FILE_COMMON flag automatically makes the file accessible to other terminals?

 But out of curiosity, I'm not sure what you mean by the file doesn't exist. As I said in the original, I copied and pasted the path from the file Properties. Windows says it exists. Are you saying that MT disagrees? Like some alternative reality?

whroeder1
13641
whroeder1 2014.06.12 13:58  
LouK:But out of curiosity, I'm not sure what you mean by the file doesn't exist.
With out the common flag open("xxx/yyy") means open the file "c:\...MQL4\files\xxx\yyy" so open("c:\...\mql4\files\xxx\yy") means open the file "c:\...\mql4\files\c:\...\mql4\files\xxx\yyy" and there is no such file "c:\...\mql4\files\c:\...\mql4\files\xxx\yyy"
/
To add comments, please log in or register