want to take hex dump of a string. How ?
-
Hi, I want to take hex dump of a string and print like "00.ff.2e:3f:00:4d". Is there any api available in 'C' or 'C++' ? Thanks, Sakthi
Nice things do nice works
Well, there are keywords & functions, for instance:
strlen
,for
,printf
. :rolleyes: :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi, I want to take hex dump of a string and print like "00.ff.2e:3f:00:4d". Is there any api available in 'C' or 'C++' ? Thanks, Sakthi
Nice things do nice works
-
Code: printf("%02d:%02d:%02d:%02d:%02d:%02d\n", 0x00, 0xff, 0x2e, 0x3f, 0x00, 0x4d); printf("%02x:%02x:%02x:%02x:%02x:%02x\n", 0x00, 0xff, 0x2e, 0x3f, 0x00, 0x4d); Output: 00:255:46:63:00:77 00:ff:2e:3f:00:4d
for me, why happens like this below, ffffffde:0e:6e:28:53:3d:ffffff88:0d:ffffff87:ffffffc1:ffffffe7: 4f:ffffffe8:ffffff9d:ffffff84:ffffffe8:3d:06:ffffff81:ffffffe0: ffffff8f:ffffff9a:77:08:75:3d:fffffff1:38:45:ffffff8f:ffffffe8: ffffffad:03 Thanks, Sakthi
Nice things do nice works
-
for me, why happens like this below, ffffffde:0e:6e:28:53:3d:ffffff88:0d:ffffff87:ffffffc1:ffffffe7: 4f:ffffffe8:ffffff9d:ffffff84:ffffffe8:3d:06:ffffff81:ffffffe0: ffffff8f:ffffff9a:77:08:75:3d:fffffff1:38:45:ffffff8f:ffffffe8: ffffffad:03 Thanks, Sakthi
Nice things do nice works
Hint: you're probably using signed data types. :rolleyes: Hint2:
FFFFFFDE
is-34
(i.e.222
if_unsigned_ char
). :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]