所有的原生字符串类型String转PAnsiChar都需要经过AnsiString过渡
strAnsi:= PAnsiChar(AnsiString(str));
In D2009 and later: yes, there is. PChar is a pointer to a Char which is a unicode character (a WideChar). And PAnsiChar is a pointer to a AnsiChar, which is - as the name implies - an ANSI character.
EDIT: For pre-2009 versions of Delphi PChar and PAnsiChar are exactly the same. They both point to an (Ansi) character.
delphi2009及以上版本中String与PAnsiChar转换
原文:https://www.cnblogs.com/FKdelphi/p/13622498.html