Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Incrementing IPv6 address

hello every body.
I am working in address incrementation(+1) using c language.User
inputs a value which is in hex address and incremented by 1.
Suppose my address is - abc5:5723:2109:ffff:76af:82ea:9256:ffff.
So my output becomes - abc5:5723:2109:ffff:76af:82ea:9257:0000

I already parse the entire string and put it in 8 different array but
unable to do when the the last 4 digit reaches FFFF..I could not write
the logic of that last portion.can any body help me to solve the
problem?

My code is -

#include "stdafx.h"
#include "conio.h"
#include "stdio.h"
#include "string.h"


int _tmain(int argc, _TCHAR* argv[])
{
char address[] = "abc5:5723:2109:ffff:76af:82ea:9256:ffff";
printf("Your IPv6 address is ");
puts(address);
char a[10], b[10], c[10], d[10], e[10], f[10], g[10], h[10];
if(sscanf(address, "%10[^:]:%10[^:]:%10[^:]:%10[^:]:%10[^:]:
%10[^:]:%10[^:]:%10[^:]:",a,b,c,d,e,f,g,h)==8)
{
//puts(a);
//puts(b);
}
int m,n,o,p,q,r,s,t;
sscanf(a,"%x", &m);
sscanf(b,"%x", &n);
sscanf(c,"%x", &o);
sscanf(d,"%x", &p);
sscanf(e,"%x", &q);
sscanf(f,"%x", &r);
sscanf(g,"%x", &s);
sscanf(h,"%x", &t);

t++;


printf("The final output is %x:%x:%x:%x:%x:%x:%x:%x",m,n,o,p,q,r,s,t);


getch();
return 0;

}

Output -

You IPv6 address is abc5:5723:2109:ffff:76af:82ea:9256:ffff
The final output is abc5:5723:2109:ffff:76af:82ea:9256:10000

Waiting for your reply.

Ayanava
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 230
Default Incrementing IPv6 address

On 30/11/2011 13:14, Tester Tester wrote:
hello every body.
I am working in address incrementation(+1) using c language.User

Output -

You IPv6 address is abc5:5723:2109:ffff:76af:82ea:9256:ffff
The final output is abc5:5723:2109:ffff:76af:82ea:9256:10000

Waiting for your reply.


This looks like homework. How do you think you might do it?

Hint: quite a few Web scripts fell over the exact same problem at Y2k
rollover including the USNO who should have known better.

Instead of displaying YYYY as 2000 they showed 19100 instead.

Regards,
Martin Brown
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Incrementing Part of an Address Phil Excel Worksheet Functions 1 January 4th 10 11:49 AM
How do I avoid excel change absolute address to relative address Miguel Excel Discussion (Misc queries) 3 May 10th 07 11:18 PM
long address list, name-address-city, listed vertically, how do y. kb Excel Discussion (Misc queries) 2 March 4th 05 12:48 AM
How do I import Office address book to Outlook Express address bo. snnorp Excel Discussion (Misc queries) 2 February 22nd 05 11:47 AM
LINKING Address cells from an EXCEL spreadsheet to fill MapQuest Address Info Duane S. Meyer Excel Programming 0 August 30th 03 12:16 AM


All times are GMT +1. The time now is 06:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"