System.PAnsiChar
Delphi
type PAnsiChar = ^AnsiChar;
C++
typedef char* PAnsiChar; //
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
pointer typedef |
public | System.pas sysmac.h |
System | System |
Description
Defines a null-terminated ANSI string.
PAnsiChar defines a pointer to a memory location that contains AnsiChar values (including the #0 character).
In Delphi, one can obtain a PAnsiChar value from an AnsiString, allowing seamless integration with C or C++ applications that expect null-terminated strings.
PAnsiChar is not supported by the Delphi Next Generation (mobile) compilers, but is used by the Delphi desktop compilers.
Notes:
- PAnsiChar is inherently unsafe if used in combination with normal AnsiString values. PAnsiChar variables are not reference-counted and are not copy-on-written. This may result in corruption of the AnsiString values or memory leaks.
- PAnsiChar is used by the Delphi desktop and mobile compilers, for more information, see Migrating Delphi Code to Mobile from Desktop.
Warning: Do not cast non-character pointer types to PAnsiChar to do pointer arithmetic. Instead, use the PByte pointer type, which is declared with the {$POINTERMATH ON} compiler directive.