SetStr procedure
Allocate a copy of a shortstring on the heap.
Declaration
procedure SetStr(var p: PString; const s: string)Description
SetStr makes a copy of the string
S on the heap and
returns the pointer to this copy in
P. If
P pointed to
another string (i.e. was not
Nil, the memory is released first.
Contrary to
NewStr, if the string is empty then a pointer to
an empty string is returned.
The allocated memory is not based on the declared size of the string passed
to NewStr, but is based on the actual length of the string.
Errors
If not enough memory is available, an 'out of memory' error will occur.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
