That depends on what you're trying to do with it. Are you using the address yourself, or are you passing it to external code?
If you're using it yourself, try thoiz_vd's answer. As a general rule, keep as much of your internal string processing on the string type as you can. It'll save you a lot of hassle.
On the other hand, if you're passing it to an external routine, like something in the Windows API, you have to make sure the data is in the format that the API is expecting. This is a bit less clear-cut than the first case, because when Delphi transitioned from AnsiString
to UnicodeString
as the fundamental string type, they redid a lot of the winapi headers in the Windows
unit to resolve to equivalent widechar versions of the routines that took strings.
So check what you're sending it to. If it requires a PChar
, use thoiz_vd's answer. But if it's expecting a PAnsiChar
, redeclare pAddr
as PAnsiChar
.