RAD Studio |  |

String to PChar Conversions
See Also
Collapse All

Long string (AnsiString and UnicodeString) to PChar conversions are not automatic. Some of the differences between strings and PChars can make conversions problematic:

- Long strings are reference-counted, while PChars are not.
- Assigning to a string copies the data, while a PChar is a pointer to memory.
- Long strings are null-terminated and also contain the length of the string and other information, while PChars are simply null-terminated.

Situations in which these differences can cause subtle errors are discussed in the following topics:

- String dependencies
- Returning a PChar local variable
- Passing a local variable as a PChar

See Also

Declaring and Initializing Strings

Mixing and Converting String Types

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!