From Delphi Help Keyword String to Pchar Conversions
The long string is converted to PCHAR is not automatic. The difference between them caused their conversion.
1. Long strings are referenced, and PCHAR is not
2, assignment to the long string is the copy of the data, and PCHAR is a pointer to the data.
3, the long string is the end of the empty, and contains the length of the string. PCHAR is the end of the simple empty end. (The empty end finger ends with # 0)
Procedure my_func (x: string);
Begin
Some_Proc (PCHAR (X)); // Refer to the first, do you want to be responsible for x's survival
END;
Function Title (N: Integer): PCHAR;
VAR
String;
Begin
S: = format ('Title -% D', [N]);
Result: = pchar (s); // Refer to article 2, can not do this
END;