From RAD Studio API Documentation
Jump to: navigation, search


function WideStrAlloc(Size: Cardinal): PWideChar;


extern DELPHI_PACKAGE System::WideChar * __fastcall WideStrAlloc(unsigned Size);


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


Allocates a buffer for a null-terminated wide string and returns a pointer to its first character.

WideStrAlloc allocates a buffer for a null-terminated string with a maximum length of Size - 1 (2 bytes must be reserved for the termination character). The result points to the location where the first character of the string is to be stored. A 32-bit number giving the total amount of memory allocated is stored in the four bytes preceding the first character; it is equal to (Size * 2) + 4. If the space for a string is allocated with WideStrAlloc, it should be deallocated through StrDispose.

Because WideStrings are implicitly null-terminated and dynamically allocated, the use of WideStrAlloc is deprecated.

See Also