string a, dt, b;
to
string a, b; string dt = "";
I changed the line
to
What do you expect "" to print?
It's still an empty string.
What do you expect "" to print?
It's still an empty string.
StringConcatenate
suppose to change before printing. What am I missing????
Your code is a mess.
Stop declaring variables as you go, it makes the code unreadable. All variablers are declared at the top of the Function/Method/Class/Whatever.
And who (and where) the hell are "a" and "b"? Also, there is no memory cost on naming your variables in a meaningful way.
The code is running as expected. Do you know what an ELSE IF does??
samjesse:
and that is what
StringConcatenate
suppose to change before printing. What am I missing????
Sorry, I was thinking of mql4, not mql5
Your code is a mess.
Stop declaring variables as you go, it makes the code unreadable. All variablers are declared at the top of the Function/Method/Class/Whatever.
And who (and where) the hell are "a" and "b"? Also, there is no memory cost on naming your variables in a meaningful way.
The code is running as expected. Do you know what an ELSE IF does??
The reason for having the variable inside the first loop (and not the the beginning of the function) is to clear it from it content every time so that the second loop builds the new intended string consisting of the date and time "as coded".
ELSE IF block will be executed the first time which will allow the "dt" string to have the date and the second time to add the time to the date. Remember, the "dt" has not be re initialized to a "" string yet as the second loop is running. It only gets re initialized when the first loop runs.
What Am I missing???
It appears to me that when the else if block is exited, the work of the StringConcatenate is lost, which is counter intuitive. notice the signature from the docs. the first variable is passed by reference.
int StringConcatenate( string& string_var, // string to form void argument1 // first parameter of any simple type void argument2 // second parameter of any simple type ... // next parameter of any simple type );
It appears to me that when the else if block is exited, the work of the StringConcatenate is lost, which is counter intuitive. notice the signature from the docs. the first variable is passed by reference.
Are you running this code in MT4 or MT5? Because there is difference :)
Are you running this code in MT4 or MT5? Because there is difference :)
MT5.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
Please see the comment in the code below, the Print(dt) in the second time suppose to print the date and time, but it only prints the time even though the dt variable has not be re initialized. Why the dt variable did not keep its value between the loops when it is out side the loop?
Thanks