- what is the difference of " t" and ' t' ?
- Volatility Quality Index
- Read File Function build 600
I think you should try for instance:
"c:\\metatrader\\experts\\files\\interest_rates.csv"
or
"c:/metatrader/experts/......"
Correct.
@whitebloodcell - The reason is that the backslash character has a special purpose in the context of a string. It says - treat the following character differently to normal.
Lets take the string abc.
string mystring = "abc";
The double quotes are used to mark the beginning and end of the string.
Now let's suppose we want the string to contain a"bc then:
string mystring = "a"bc";
Wouldn't work as the compiler would not be able to tell which set of double quotes ended the string.
So we use the backslash to say - treat the next character differently to what you would normally treat it.
Hence we declare:
string mystring = "a\"bc";
However if we have the following string:
string mystring = "directory\filename";
The compiler will think - ah here's a backslash, so the f must be treated differently to normal, therefore, as a special character. Obviously this won't work.
So we use the backslash before the backslash to tell the compiler to treat the second backslash differently than normal - ie. treat it not as a special character to alter the next character, but as an ordinary backslash.
string mystring = "directory\\filename";
Here's the relevant entry in the documentation.
https://docs.mql4.com/basis/types/literal
PS: can't believe you'd never heard of double quotes - you only used 6 of the damn things in your original question!!
CB
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use