From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function StrNew(const Str: PAnsiChar): PAnsiChar;
function StrNew(const Str: PWideChar): PWideChar;


extern DELPHI_PACKAGE char * __fastcall StrNew _DEPRECATED_ATTRIBUTE1("Moved to the AnsiStrings unit") (const char * Str)/* overload */;


Type Visibility Source Unit Parent
function public
System.SysUtils System.SysUtils


Warning: Ansi version of StrNew is deprecated. Please use AnsiStrings unit.

Allocates space on and copies a string to the heap, returning a pointer to the string.

StrNew allocates a copy of Str on the heap.

If Str is nil (Object Pascal) or NULL (C++) or points to an empty string, StrNew returns a pointer to a new empty string.

Otherwise, StrNew makes a duplicate of Str, obtaining space with a call to StrAlloc and returns a pointer to the duplicated string.

The allocated space is the length of Str + 5 bytes.

See Also

Code Examples