System.AnsiStrings.StrNew

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

Delphi

function StrNew(const Str: PAnsiChar): PAnsiChar;

C++

extern DELPHI_PACKAGE char * __fastcall StrNew(const char * Str)/* overload */;

プロパティ

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

説明

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

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

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

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

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

関連項目