[Solved] How to convert IPv4 address to decimal
It turns out that Winsock 2 provides the inet_addr() function, which simply returns the equivalent decimal value for the address. #include <stdio.h> #include <winsock2.h> int main(void) { char* pAddr = “192.168.0.1”; unsigned long value = inet_addr(pAddr); if (value == INADDR_NONE) printf(“Invalid format of IP address”); else printf(“Decimal representation of %s is: %lu”, pAddr, value); return … Read more