Danke, funktioniert!
Hier der komplette Teilcode:
Delphi-Quellcode:
{ Dumb conversion of number of bits to 4-byte SubnetMask string}
function SubnetMask(ACode: string): string;
begin
var NCode := ACode.ToInteger;
if NCode < 25 then
// Result := '255.255.255.' + (%11111111 shr NCode).ToString
Result := '255.255.255.' + (255 shr NCode).ToString
else if NCode < 33 then
// Result := '255.255.' + (%11111111 shr NCode-24).ToString + '.0'
Result := '255.255.' + (255 shr NCode-24).ToString + '.0'
else if NCode < 41 then
// Result := '255.' + (%11111111 shr NCode-32).ToString + '.0.0'
Result := '255.' + (255 shr NCode-32).ToString + '.0.0'
else if NCode < 49 then
// Result := (%11111111 shr NCode-40).ToString + '.0.0.0'
Result := (255 shr NCode-40).ToString + '.0.0.0'
else
Result := '0.0.0.0.';
end;
Ciao
Stefan