PAnsiChar Type
The PAnsiChar
type is a pointer to
AnsiChar
and with Delphi’s extended syntax,
it can also be treated as an AnsiString
or a
pointer to an array of AnsiChar
.
PAnsiChar
is used most often as a parameter type
for DLLs written in C or C++, such as the Windows
API.
You can treat a PAnsiChar
pointer as a pointer to
an array of AnsiChar
. The array index is an
Integer
subrange, starting from zero. Delphi does
not provide any bounds checking for the array. The convention is that
the end of the string is denoted by the presence of the
#0
character.
Perform pointer arithmetic on a PAnsiChar
pointer
by adding and subtracting integers similar to the way the
Inc
and Dec
procedures
work.
Delphi’s extended syntax is enabled by default. Use the
$X
or $ExtendedSyntax
compiler
directive to disable this feature and revert to behavior closer to
standard Pascal.