title: How to convert from PAnsichar to PWidechar?
body: <p>I am implementing Ping function using windows API in delphi-xe3 from here
  (<a href="http://delphi.about.com/od/internetintranet/l/aa081503a.htm" rel="nofollow">http://delphi.about.com/od/internetintranet/l/aa081503a.htm</a>).</p>
  
  <p>I am having problem with the following function.It displays error incompatible type Pansichar and Pwidechar.I replaced Pchar with PAnsichar now it displays exception
  'Error getting IP from HostName'.</p>
  
  <p>I am testing it with localhost.</p>
  
  <p>Please guide whats the proper conversion.</p>
  
  <pre><code>const ADP_IP = '127.0.0.1';
  
  procedure TranslateStringToTInAddr(AIP: string; var AInAddr);
  var
    phe: PHostEnt;
    pac: PChar;
    GInitData: TWSAData;
  begin
    WSAStartup($101, GInitData);
    try
      phe := GetHostByName(PChar(AIP));
      if Assigned(phe) then
      begin
        pac := phe^.h_addr_list^;
        if Assigned(pac) then
        begin
          with TIPAddr(AInAddr).S_un_b do begin
            s_b1 := Byte(pac[0]);
            s_b2 := Byte(pac[1]);
            s_b3 := Byte(pac[2]);
            s_b4 := Byte(pac[3]);
          end;
        end
        else
        begin
          raise Exception.Create('Error getting IP from HostName');
        end;
      end
      else
      begin
        raise Exception.Create('Error getting HostName');
      end;
    except
      FillChar(AInAddr, SizeOf(AInAddr), #0);
    end;
    WSACleanup;
  end;
  </code></pre>