HP3000-L Archives

September 2000, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Bill Cadier <[log in to unmask]>
Reply To:
Bill Cadier <[log in to unmask]>
Date:
Tue, 26 Sep 2000 17:10:52 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (57 lines)
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.....
>

ATOM RSS1 RSS2