Op 28-07-16 om 10:38 schreef Christo:
The in_addr IP address type is a packed record of byte, so if an IP
address part larger than 255 is encountered in a string it will be
truncated when copied to the byte record using StrToHostAddr. This
probably means you have to use some other means of dete
Am Donnerstag, 28. Juli 2016, 10:26:32 schrieb Jonas Maebe:
> On 28/07/16 10:14, Koenraad Lelong wrote:
> > I need a way to test if an string containing an ipv4-address is really
> > an ipv4-address.
> > I tried
> > tmpAddress:=HostAddrToStr(StrToHostAddr(IPAddressStr));
> > writeln(tmpAddress);
>
On Thu, 2016-07-28 at 10:14 +0200, Koenraad Lelong wrote:
> When I enter 192.168.185.297 (i.e. not a valid ipv4 address) in
> IPAddressStr I get
> 192.168.185.41
> not the expected error-message.
>
> According to the rtl-manual :
>
> function StrToHostAddr(IP: AnsiString) : in_addr
> Description
On Thu, 28 Jul 2016 10:26:32 +0200
Jonas Maebe wrote:
> On 28/07/16 10:14, Koenraad Lelong wrote:
> > I need a way to test if an string containing an ipv4-address is really
> > an ipv4-address.
> > I tried
> > tmpAddress:=HostAddrToStr(StrToHostAddr(IPAddressStr));
> > writeln(tmpAddress);
> > i
The IP-Adress is a dword, but you can change, that it fits for you.
function str_getval( str : shortstring ) : longint;
var cod : longint;
begin
val( str , result , cod );
end;
function ip_from_string( ipstr : shortstring ; out error : boolean ) : dword;
var
c : char;
ipn , pointanz : longint
On 28/07/16 10:14, Koenraad Lelong wrote:
I need a way to test if an string containing an ipv4-address is really
an ipv4-address.
I tried
tmpAddress:=HostAddrToStr(StrToHostAddr(IPAddressStr));
writeln(tmpAddress);
if (tmpAddress='0.0.0.0') then
begin
writeln('Error in IP-address');
IPAd
Hi,
I need a way to test if an string containing an ipv4-address is really
an ipv4-address.
I tried
tmpAddress:=HostAddrToStr(StrToHostAddr(IPAddressStr));
writeln(tmpAddress);
if (tmpAddress='0.0.0.0') then
begin
writeln('Error in IP-address');
IPAddressStr:=tmpAddress;
end;
When I