#include <TypeToBytes.mqh> // https://www.mql5.com/ru/code/16280 void OnStart() { uchar bytes[8]; ulong Value = 0; _W(Value) = bytes; }
fxsaber #:
I am using MT5.. not sure what version but fairly recent.
I got an error something like "initialization for array sequence needed"
for
STRUCT_READ<T1> Res = {0};
so it would not compile.. there was also some other error further down that I forget.
both went away when I changed it to = {};
I have not tested the code yet ... I'm guessing this is ok
Alternatively | template<typename From, typename To> void reinterpret_cast(const From& f, To& t){ union _u{ From from; const To to; } u; u.from=f; t=u.to; } |

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
How can I convert
uchar bytes[8];
to a ulong ?