Download MetaTrader 5
To add comments, please log in or register
MQL5 Reference is available in 8 languages. Learn MQL5 in the language that suits you best!
mop0
197
mop0 2014.04.10 13:03 

I tried writing to the following common MT4 folder in Windows 8 but it isn't working:

string BaseDirectory = "C:\Users\<name>\AppData\Roaming\MetaQuotes\Terminal\Common";

int FileHandle = FileOpen(BaseDirectory+"\\thefile.txt",FILE_WRITE|FILE_CSV);
FileWrite(FileHandle,TimeCurrent());
FileClose(FileHandle); 

Do I have the right common folder and/or the right name format?

Edit: additional info:

I can write fine to the terminal's folder C:\Users\<name>\AppData\Roaming\MetaQuotes\Terminal\2DDC50D2844ACA35FFD080E7BF7EC474\MQL4\Files by removing the BaseDirectory+ and \\.

qjol
3243
qjol 2014.04.10 13:24  
mop0
197
mop0 2014.04.10 13:31  

Still doesn't seem to work.

string common_data_path=TerminalInfoString(TERMINAL_COMMONDATA_PATH);
int FileHandle = FileOpen(common_data_path+"\\thefile.txt",FILE_WRITE|FILE_CSV|FILE_COMMON);
FileWrite(FileHandle,TimeCurrent());
FileClose(FileHandle); 
mop0
197
mop0 2014.04.10 13:41  

nevermind, eventually got it, no need for common_data_path.

Thanks!

Solution in case anyone ever searches this topic with the same problem as me:

int FileHandle = FileOpen("thefile.txt",FILE_WRITE|FILE_CSV|FILE_COMMON);
FileWrite(FileHandle,TimeCurrent());
FileClose(FileHandle); 




/
To add comments, please log in or register