title: copy array of ansichar to array of char delphi 10.2
body: <p>as we know from Delphi 2007 and below the strings are not Unicode</p>
  
  <p>Char is 1 byte</p>
  
  <p>AnsiChar 1 byte</p>
  
  <p>from Delphi 2009 and above the strings are Unicode</p>
  
  <p>Char is 2 byte</p>
  
  <p>AnsiChar 1 byte</p>
  
  <p>when i convert my Delphi code from Delphi6 to Delphi 10.2( unicode string) 
  i faced problem of some functions take PAnsiChar to fill array of Char, but the pointer passed is PChar, in non Unicode Delphi i will not get any error</p>
  
  <p>but i will get error in new Delphi
  example  </p>
  
  <pre><code>procedure TswSocket.SetLocalHost(AHost : AnsiString);
  var
    HostIpAddress : TIPAddress;
    Buffer: PChar;
  
    begin
    Buffer:=StrAlloc(Length(AHost)+1);
    strpcopy(Buffer,AHost);
    Buffer[Length(AHost)]:=#0;
    bLocalHost:=StrAlloc(MAXGETHOSTSTRUCT);
    hGetLocalHost:=WSAAsyncGetHostByName(Self.hWindow,WM_SOCKETGETHOSTBYNAME,Buffer,bLocalHost,MAXGETHOSTSTRUCT); // Buffer,bLocalHost must be PAnsiChar instead of PChar
  </code></pre>
  
  <p>WSAAsyncGetHostByName will fill bLocalHost </p>
  
  <p>to fix the error i used </p>
  
  <pre><code>procedure TswSocket.SetLocalHost(AHost : AnsiString);
  var
    HostIpAddress : TIPAddress;
    Buffer,temp_Buffer : PAnsiChar;
  
    begin
    Buffer:=AnsiStrAlloc(Length(AHost)+1);
    strpcopy(Buffer,AHost);
    Buffer[Length(AHost)]:=#0;
  
    temp_Buffer:=AnsiStrAlloc(MAXGETHOSTSTRUCT);
    bLocalHost:=StrAlloc(MAXGETHOSTSTRUCT);
    hGetLocalHost:=WSAAsyncGetHostByName(Self.hWindow,WM_SOCKETGETHOSTBYNAME,Buffer,temp_Buffer,MAXGETHOSTSTRUCT); // no error : Buffer,temp_Buffer is PAnsiChar 
  </code></pre>
  
  <p>now the result in temp_Buffer( Array of AnsiChar) but we need the result in bLocalHost (array of Char)</p>
  
  <p>is there any  function like this copy(PAnsiChar,PChar,size)
   copy content of PAnsiChar to PChar like array without lost data due the Unicode ,so if temp_Buffer ='some data' then bLocalHost must be ='some data' ?</p>