HEAP_Set

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Core Language > BuiltIn Functions > Memory handling and pointers > Heap memory >

HEAP_Set

 

Description

 

Allocate or Re-allocates a block of memory.

 

The size of the block is the size of the passed string.

pMem pointer is first de-allocated, the passed string is copied into a new memory block.

 

Syntax

 

ptr = HEAP_Set(pMem, String)

 

Returns

 

Number: pointer to the allocated memory area.

If the function succeeds, the return value is a pointer to the new allocated memory block.

 

Parameters

 

Name

Type

Optional

Meaning

pMem

Number

No

Pointer to a heap memory to be allocated / re-allocated.

Attention: this parameter is intended as passed BYREF so it must be a variable of at least 32bits.

String

String

No

String data to be allocated

 

Remarks

 

Attention: pMem parameter is intended as passed BYREF so it must be a variable of at least 32bits.

 

This function works like HEAP_Free and HEAP_AllocByStr in one go

 

Restrictions

 

See also

 

Examples