Sign in Join
FPDoc Onlineexperiment

StrAlloc function

In unit sysutils

Allocate a null-terminated string on the heap.

Declaration

pascal
function StrAlloc(Size: Cardinal): PAnsiChar

Description

StrAlloc reserves memory on the heap for a string with length Len, terminating #0 included, and returns a pointer to it.

Additionally, StrAlloc allocates 4 extra bytes to store the size of the allocated memory. Therefore this function is NOT compatible with the StrAlloc function of the Strings unit.

For an example, see StrBufSize.

Errors

None.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.