Hi guy .
I don`t known how to convert IP to hex .
In this link http://www.mustat.com/70.42.23.121 (Ip host codeguru.com) . I see hex IP : Hex IP 0x462a1779
I want to convert IP "70.42.23.121" to "0x462a1779"
Did you try IP "123.30.128.10" , IP hex : 0x7b1e800aCode:#include <winsock.h> #include <windows.h> #include <stdio.h> UINT32 ip_to_hex(UINT32 ip_add) { UINT32 ip_hex; //code convert ip to hex return ip_hex; } void main() { //ip_to_hex(70.42.23.121); system("pause"); }
When i try "%x" , it`s wrong
Code:printf("%x \n", 123); printf("%x \n", 30); printf("%x \n", 128); printf("%x \n", 10);
And this is result
7b 1e 80 and a , not 0a
further i think we must separate each octect by a (dot) . , Then convert decimal to hexa
Can you help me ?
Thank guy.


Reply With Quote
Bookmarks