S
snail1024
Unregistered / Unconfirmed
GUEST, unregistred user!
我有这们的代码为什么不能实现这种转换呢?是不可以吗?谢谢请指点一下!
function TfrmMain.IPToMAC(IPAdd:string;ISFormat:boolean):string;
var
MacAddr:array[1..6]of byte;
MacAddrLen:ULONG;
retWORD;
begin
MacAddrLen:=sizeof(MacAddr);
ret:=SendARP(inet_addr(pChar(IPAdd)),0,@MacAddr,MacAddrLen);
if ret=
0 then
if isformat then
result:=format('%2.2x-%2.2x-%2.2x-%2.2x-%2.2x-%2.2x',[MacAddr[1],MacAddr[2],MacAddr[3],MacAddr[4],MacAddr[5],MacAddr[6]])
else
result:=format('%2.2x-%2.2x-%2.2x-%2.2x-%2.2x-%2.2x',[MacAddr[1],MacAddr[2],MacAddr[3],MacAddr[4],MacAddr[5],MacAddr[6]])
else Result:=('No Ack!');
end;
function TfrmMain.IPToMAC(IPAdd:string;ISFormat:boolean):string;
var
MacAddr:array[1..6]of byte;
MacAddrLen:ULONG;
retWORD;
begin
MacAddrLen:=sizeof(MacAddr);
ret:=SendARP(inet_addr(pChar(IPAdd)),0,@MacAddr,MacAddrLen);
if ret=
代码:
if isformat then
result:=format('%2.2x-%2.2x-%2.2x-%2.2x-%2.2x-%2.2x',[MacAddr[1],MacAddr[2],MacAddr[3],MacAddr[4],MacAddr[5],MacAddr[6]])
else
result:=format('%2.2x-%2.2x-%2.2x-%2.2x-%2.2x-%2.2x',[MacAddr[1],MacAddr[2],MacAddr[3],MacAddr[4],MacAddr[5],MacAddr[6]])
else Result:=('No Ack!');
end;