title: Delphi XE2 incompatible types pointer and PAnsiChar
body: <p>I am compiling my application in <strong>Delphi XE2</strong>.It was developed in <strong>delphi 7.</strong>. My code is as follows:</p>
  
  <pre><code>type
   Name = array[0..100] of PChar;
   PName = ^Name;
  var
    HEnt: pHostEnt;
    HName: PName;
    WSAData: TWSAData;
    i: Integer;
  
  begin
       Result := False;
       if WSAStartup($0101, WSAData) &lt;&gt; 0 then begin
       WSAErr := 'Winsock is not responding."';
         Exit;
       end;
      IPaddr := '';
      New(HName);
  
  
   if GetHostName(HName^, SizeOf(Name)) = 0 then &lt;-----ERROR
     begin
        HostName := StrPas(HName^);      
  
        HEnt := GetHostByName(HName^);    
              "
              "
           so on...
     end;
  </code></pre>
  
  <p>When i try to compile the code ,i  get the  following error:
   <img src="https://i.stack.imgur.com/jS90K.png" alt="enter image description here"></p>
  
  <p>When i try this code in another application it works fine in Delphi 7.
  How do i convert from character pointer to <strong>PAnsiChar</strong> type to make it run on <strong>Delphi XE2</strong>??.</p>