Link to home
Start Free TrialLog in
Avatar of aluiken
aluiken

asked on

Long ip's

Hi there,

Does anyone have a peice of source code for me that can convert a 32-bit long ip (eg 3498393929112 ???) to an normal ip adress like 192.168.0.1 en visa versa.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Madshi
Madshi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Madshi
Madshi

P.S: Add "winSock" to your "uses" clause.
sh*t - u've been faster again...

;-)
SlowDeath.
Avatar of aluiken

ASKER

Okiz, but the other way around ?

Or is the func to convert a '192.168.0.1' like to an long the inet_addr func ?
My example does both. "inet_addr" converts a string into an integer. "inet_ntoa" goes the other way round (integer -> string). Easy, isn't it!?   :-)

Sorry to SlowDeath...   :-))

P.S: If you want to convert a string variable into an integer, do this:

intVar:=inet_addr(pchar(strVar));
Avatar of aluiken

ASKER

Okiz thx !
If it works, please don't forget to accept my answer...   :-)
Avatar of aluiken

ASKER

Sorry =) got the wrong button.

(Did not check it if it works tough)

Greets