On Thu, 8 Jun 2000, Willem Brown wrote:

> > > http://3454552827/users/nfc4/teen5.html
> 
> I don't want to sound stupid, how does this, '3454552827', get translated to
> an ip address?

An IP address is basically just 4 bytes in a row, where a byte consists of
8 bits (each of which can be only 0 or 1).
The normal way of reading an IP address is keeping each byte separate,
i.e. reading
        00000001    00000010    00000011    00000100
as 4 completely different entities by converting each of these binary
numbers to decimal and separating them with dots (the above would be
1.2.3.4).
It is just as valid to read them as one large number
        00000001000000100000001100000100
Which is a completely different large number in decimal - but address-wise
they're the same.

The simplest way to make them readable is

#include <stdio.h>
main()
{
        unsigned long l=htonl(3454552827);
        unsigned char *s=(unsigned char *)&l;
        printf("%u.%u.%u.%u\n", s[0], s[1], s[2], s[3]);
}

LLaP
bero



-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to