H
h_o_u_l_i
Unregistered / Unconfirmed
GUEST, unregistred user!
我在程序中要获得本机的IP,用function gethostbyname(name: PChar): PHostEnt; stdcall;另我头疼且不解的是如和从Phostent类型中解析出iP来?
delphi的winsock单元中PHostEnt的结构是如下定义的:
type
PHostEnt = ^THostEnt;
{$EXTERNALSYM hostent}
hostent = record
h_name: PChar;
h_aliases: ^PChar;
h_addrtype: Smallint;
h_length: Smallint;
case Byte of
0: (h_addr_list: ^PChar);//此处的^pchar类型是什么意思,如何使用此类型,
我该如何使用h_addr_list从而得到IP 地址?请大侠门给段代码并解释一下.......敬礼了!
1: (h_addr: ^PChar)
end;
THostEnt = hostent;