Board logo

Subject: 以下代码格式化出错. [Print This Page]

Author: fxerp@qq.com    Time: 2015-9-17 11:23     Subject: 以下代码格式化出错.

function GetLocalIP: string;
var
  WSData: TWSAData;
  Buffer: array[0..63] of ansiChar;
  HostEnt: PHostEnt;
  PPInAddr: ^PInAddr;
  IPString: string;
begin
  IPString := '';
  try
    WSAStartUp($101, WSData);
    GetHostName(Buffer, SizeOf(Buffer));
    HostEnt := GetHostByName(Buffer);
    if Assigned(HostEnt) then
    begin
      PPInAddr := @(PInAddr(HostEnt.H_Addr_List^));
      while Assigned(PPInAddr^) do
      begin
        IPString := string(StrPas(INet_NToA(PPInAddr^^)));
        Inc(PPInAddr);
      end;
    end;
    Result := IPString;
  finally
    try
      WSACleanUp;
    except
    end;
  end;
end;
Author: Passion    Time: 2015-9-17 16:24

感谢报告,这是上一两个版本增加对^J^M这样的字符串支持时带来的副作用。下一版本将修正。
Author: Passion    Time: 2015-9-18 05:17

771版本已经修正,http://www.cnpack.org/downbuilds.php




Welcome to CnPack Forum (http://bbs.cnpack.org/) Powered by Discuz! 5.0.0