W
wenmang
Hi all,
I have a confusion for representation of hex number:
For an unsigned long long number, its max value is:
unsigned long long maxNum = 18446744073709551615;
if I do:
printf("max uint64_t value in hex is %x\n", maxNum);
it prints as:
"max uint64_t value in hex is ffffffff"
but "ffffffff" is the max if I directly input it into MS calculator?
So, what is hex number for 18446744073709551615? it should be
0xffffffffffffffff, isn't it?
The next thing I like to do is to represent the max
number(18446744073709551615) as octet string, how can I do it?
I tried following but it seems not right:
unsigned long long maxNum=18446744073709551615;
unsigned char hexNumStr[sizeof(unsigned long long)];
memcpy(&hexNumStr, &maxNum, sizeof(unsigned long long));
how am I going to print out the content of hexNum as a string?
thx
I have a confusion for representation of hex number:
For an unsigned long long number, its max value is:
unsigned long long maxNum = 18446744073709551615;
if I do:
printf("max uint64_t value in hex is %x\n", maxNum);
it prints as:
"max uint64_t value in hex is ffffffff"
but "ffffffff" is the max if I directly input it into MS calculator?
So, what is hex number for 18446744073709551615? it should be
0xffffffffffffffff, isn't it?
The next thing I like to do is to represent the max
number(18446744073709551615) as octet string, how can I do it?
I tried following but it seems not right:
unsigned long long maxNum=18446744073709551615;
unsigned char hexNumStr[sizeof(unsigned long long)];
memcpy(&hexNumStr, &maxNum, sizeof(unsigned long long));
how am I going to print out the content of hexNum as a string?
thx