Writing a file to the common folder (script)

 

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 \\.

 
 

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); 
 

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); 




Reason: