hello every body,
My name is roxy and i am from brazil.I want to expand IPv6 address using inet_pton().After that increment the address by 1 using C code.If my address is - 1234:12::ffff then after expand it will be 1234:0012:0000:0000:0000:0000:0000:ffff
When I increment the address it will display - 1234:0012:0000:0000:0000:0000:0001:0000
Whenever it will reaches ffff it just put 0x0000 and increment the next value by 1.
I already done some code part(not the increment part).Please help me in this matter.
Code -
#include "stdafx.h"
#include "string.h"
#include "stdlib.h"
#include "conio.h"
#include "arpa/inet.h"
#include "inet/ip6.h"
int main(int argc, char argv[])
{
struct in6_addr {
unsigned char s6_addr[16]; // IPv6 address
};
struct in6_addr ipv6;
char str[]="abcd:1234::ffff";
if(strcnt(str,":")>1)
{
if(inet_pton(AF_INET6,str,&ipv6.s6_addr))
printf("%s is
%0llu(IPv6)\n",str,ipv6.s6_addr);
else
printf("Error..");
}
getch();
return 0;
}