krot

convert dword to ip address

May 10th, 2016
87
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unsigned char a, b, c, d;  
  2.     d = pIp4Array->AddrArray[0] & 0xFF;  
  3.     c = (pIp4Array->AddrArray[0] >> 8) & 0xFF;  
  4.     b = (pIp4Array->AddrArray[0] >> 16) & 0xFF;  
  5.     a = (pIp4Array->AddrArray[0] >> 24) & 0xFF;  
  6. printf ("%u.%u.%u.%u", a, b, c, d);
  7. unsigned long IP
  8. printf("<%u.%u.%u.%u:   <%s>>\r",
  9.                                     IP&0xFF,   
  10.                                     (IP>> 8)&0xFF,
  11.                                     (IP>> 16)&0xFF,
  12.                                     (IP>> 24) & 0xFF,  
  13.  
  14.  
  15. IP:inet_ntoa(DW.sin_addr.s_addr)
RAW Paste Data