System.SysUtils.StrNew

提供: RAD Studio API Documentation
移動先: 案内検索

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 */;

プロパティ

種類 可視性 ソース ユニット
function public
System.SysUtils.pas
System.SysUtils.hpp
System.SysUtils System.SysUtils

説明

警告: StrNew の ANSI バージョンは廃止予定です。AnsiStrings ユニットを使用してください。

ヒープの領域を割り当てて文字列をコピーし,その文字列を指すポインタを返します。

StrNew 関数は,ヒープに Str のコピーを割り当てます。

Str が nil(Delphi)または NULL(C++),あるいは空の文字列を指す場合,StrNew は新しい空文字列へのポインタを返します。

それ以外の場合,StrNew は Str のコピーを作成し,StrAlloc を呼び出して領域を確保し,コピーの文字列を指すポインタを返します。

割り当てられる領域は StrLen(Str) + 5 バイトです。

関連項目