System.PChar

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

type PChar = ^Char;

C++

typedef PWideChar            PChar;            //

Properties

Type Visibility Source Unit Parent
pointer
typedef
public
System.pas
sysmac.h
System System

Description

Defines a null-terminated string.

PChar defines a pointer to a memory location that contains WideChar values (including the #0 character).

In Delphi, one can obtain a PChar value from a string or a WideString, allowing seamless integration with C or C++ applications that expect null-terminated Unicode strings.

Note: PChar is inherently unsafe if used in combination with normal string values. PChar variables are not reference-counted and are not copy-on-written. This may result in corruption of the string values or memory leaks.
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.


See Also