in my project I need to reverse IPv6 IP address for future DNS lookup.
Example:
From: 2001:db8:85a3:0:0:8a2e:370:7334
To: 7334:370:8a2e:0:0:85a3:db8:2001
How can I do this with c++? Thanks for your answers :)
PS: For IPv4 I´m using this solution:
int a,b,c,d;
char ip2[32];
sscanf(pageAddress, "%d.%d.%d.%d", &a, &b, &c, &d);
sprintf(ip2, "%d.%d.%d.%d", d, c, b, a);
std::cout << ip2 << "\n";
Is there any better solution?