- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
AnsiString str = IntToHex((__int64) longvalue, 2); // 0x01020304
char _c[11];
char *ch = str.c_str();
int len = strlen(ch);
int _s = len;
int j = 0;
_c[j++] = '0';
_c[j++] = 'x';
while (_s >= 2) {
_c[j++] = ch[_s-2];
_c[j++] = ch[_s-1];
_s-=2;
}
if (len == 7) {
_c[j++] = '0';
_c[j] = ch[0];
}
_c[10] = '\0';
unsigned long pp;
char *pEnd;
pp = strtoul (_c, &pEnd, 16); // 0x04030201 - PROFIT!