System.WideStrUtils.WStrAlloc
Delphi
function WStrAlloc(Size: Cardinal): PWideChar;
C++
extern DELPHI_PACKAGE System::WideChar * __fastcall WStrAlloc(unsigned Size);
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
function | public | System.WideStrUtils.pas System.WideStrUtils.hpp |
System.WideStrUtils | System.WideStrUtils |
説明
PWideChar 用バッファを割り当て、先頭文字へのポインタを返します。
WStrAlloc では PWideChar 用バッファを最大長 Size - 1(終端文字用に 1 バイトを確保)で割り当てます。結果のポインタは、文字列の先頭文字が格納される位置です。割り当てられた合計メモリ量の 32 ビット値は、先頭文字の前、4 バイトに格納されます。つまり Size * 2 + 4 です。文字列用領域を WStrAlloc で割り当てる場合は、WStrDispose で解放する必要があります。