Subject: | |
From: | |
Reply To: | |
Date: | Tue, 26 Sep 2000 17:10:52 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Hi Ken,
inet_addr() may be the function you're looking for. It's usually called from C
but it can be called from PASCAL, here's one way (that worked for me!):
program inetaddr (input, output);
TYPE
char_array = packed array [1..80] of char;
VAR
ipaddr : char_array;
inetaddr : bit32;
FUNCTION inet_addr ( VAR IP : char_array ) : bit32;
EXTERNAL;
BEGIN
ipaddr := '192.255.255.255';
inetaddr := inet_addr ( ipaddr );
writeln('192.255.255.255 translates to ', inetaddr:1 );
END.
The program can then be run as:
run inetaddr.prog;xl="/lib/libsocket.sl"
and produces the output:
192.255.255.255 translates to 3238002687
where 3238002687 is C0FFFFFF in hex or
C0 = 192, FF = 255.
Hope this helps!
Bill
HP/CSY
-----Original Message-----
From: Born, Ken <[log in to unmask]>
To: [log in to unmask] <[log in to unmask]>
Date: Tuesday, September 26, 2000 4:01 PM
Subject: [HP3000-L] Converting an I.P. Address Dot notation into the numeric equivela nt
>Greetings,
>I used the getenv function to extract the REMOTE_ADDR of my client browser.
>I need to convert the return dot notation of an I.P. Address to the numeric
>equivelent (INTEGER) so I could store this in the database. I do have
>PASCAL code to do this but it is over 200 lines long. Does anyone know if
>there is an intrinsic to do this?
>Thanks.....
>
|
|
|