So what's stopping you?
Not compiled, not tested.
string long_to_hex(ulong value){ string result=""; do{ result = string(value & 0xF)+result; value >>= 8; }while(value != 0); return result; }
Not compiled, not tested.
So what's stopping you?
Thank you for your support... Well... i found how to convert an string to an string containing the HEX chars... as i show in my example... but What is istopping me is is that i don't know how to do the inverse... convert a string containing HEX chars back to the original string....
Was that so hard?
Yep for me it's hard, this is the reason i came here looking for help! If my knowlegment was so extense like yours i believe i will not need to beg for help here...
About your suggestion, it is for converting a numeric value to hexadecimal right ? Well, converting to HEX i know how to do using uchar array and StringFormat output parameter "%.2X"... but i need to to the opposite...
- Converting a numeric to a hex string, I gave you.
- A uchar array and a string are the same thing, different formats.
- You need "the opposite" of what? Show us
your attempt and state the nature of your problem.
No free help
urgent help.
- Converting a numeric to a hex string, I gave you.
- A uchar array and a string are the same thing, different formats.
- You need "the opposite" of what? Show us
your attempt and state the nature of your problem.
No free help
urgent help.
I found exactly what i need here: Joao Rosas hexToInteger function
Thank you for your appointments. Your the best my friend!
static char __hex [] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ,'A', 'B', 'C', 'D', 'E', 'F' }; string IntegerToHexString(uint num) { int len=0,k=0; char buff[64]; do { uint n=num&0xF; buff[len] = __hex[n]; len++; num>>=4; } while(num!=0); for(;k<len/2;k++) { buff[k]^=buff[len-k-1]; buff[len-k-1]^=buff[k]; buff[k]^=buff[len-k-1]; } return CharArrayToString(buff,0,len); }
Unfortunately the static var __hex cannot be inside the function as a local static variable, because it will not be intialized correctly. MQ supports this is normal, but it´s not, it´s a bug of the compiler.

- 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... i am looking at documentation of CryptEncode function and there are a good example code... there are a function ArrayToEx that converts a uchar array to a Hexadecimal string... using StringFormat and "%.2X" as the output parameter.
Well, i need to know how to do the opposite: Fill an uchar array using an hexadecimal string... Here an example of converting my name to hex:
The result is:
2017.10.11 10:40:47.411 ToHex EURUSD,H1: My Name: Wemerson in Hex is: 57656D6572736F6E00
Now i waht to convert the hex value 57656D6572736F6E00 to the string represented by this hex string...