Hi could some please explain what kind of variable this is :
unsigned int endIp=(
ipEnd[0]<<24 |
ipEnd[1]<<16 |
ipEnd[2]<<8 |
ipEnd[3]);
And also how does the "(iterator & 0xFF000000)>>24" part of this loop work
for(iterator= startIp; iterator<endIp; iterator++)
{
printf("%d.%d.%d.%d\n",
(iterator & 0xFF000000)>>24,
(iterator & 0x00FF0000)>>16,
(iterator & 0x0000FF00)>>8,
(iterator & 0x000000FF)
);
}
Thank you people :)
Read about binary operators: bitshift (<<, >>), AND (&), OR (|).
Hi do understand bit shift operating but not sure whats going on here.
if this is :
unsigned int startIp=(
ipStart[0]<<24 |
ipStart[1]<<16 |
ipStart[2]<<8 |
ipStart[3]);
Then what will iterator start as? say for ipStart[0] =192. Does this mean ipstart[0]=192000000000000000000000?
I suppose my main confusin is the variables startip and end ip?
That is equivalent to:
1 2 3 4
|
unsigned int startIp =
ipStart[0] * 256*256*256 +
ipStart[1] * 256*256 +
ipStart[2] * 256 + ipStart[3];
|
Last edited on
Ok thanks. Ow and i've realised how stupid my second reply was :( sorry for that, my head feels empty today.