Download MetaTrader 5

File Reading Writing

To add comments, please log in or register
SteelAce
200
SteelAce  

In MQL5 Reference -> File Functions -> FileOpen is sample what is in this letter attachment as Sample.mq5. When you run that sample you can see that file can be written only when you give part of file path (last part of that Sample.mq5). When you give full path then file writing is unsuccessful even in that Sample.mq5 [Error code 5002 (: Invalid file name)]. In that case filename is "C:\Program Files\MetaTrader 5 Admiral Markets UK Ltd\MQL5\Files\fractals.csv" found by TerminalInfoString(TERMINAL_DATA_PATH) (Sample.mq5) . I don't understand how it can be wrong?

Files:
Sample.mq5 3 kb
ReadFile.mq5 29 kb
WriteFile.mq5 30 kb
Doerk Hilger
1188
Doerk Hilger  
because you are using the non-working example as reference. You deal with absolute paths, that does not work. 
SteelAce
200
SteelAce  
SteelAce:

In MQL5 Reference -> File Functions -> FileOpen is sample what is in this letter attachment as Sample.mq5. When you run that sample you can see that file can be written only when you give part of file path (last part of that Sample.mq5). When you give full path then file writing is unsuccessful even in that Sample.mq5 [Error code 5002 (: Invalid file name)]. In that case filename is "C:\Program Files\MetaTrader 5 Admiral Markets UK Ltd\MQL5\Files\fractals.csv" found by TerminalInfoString(TERMINAL_DATA_PATH) (Sample.mq5) . I don't understand how it can be wrong?

Problem is that files are (as if) possible to read-write only in directory ...\Files (and without giving full path of filename) but I need to Read-Write file on another drive, for exampe on drive D:\
Marco vd Heijden
Moderator
5196
Marco vd Heijden  
SteelAce:
Problem is that files are (as if) possible to read-write only in directory ...\Files (and without giving full path of filename) but I need to Read-Write file on another drive, for exampe on drive D:\
You can not go outside of the terminal directory.
To add comments, please log in or register