System.SysUtils.StrNew

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

C++

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

Properties

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

Description

Warning: The ANSI version of StrNew is deprecated. Please use the 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 (Delphi) 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