Core Function Alloc
From Sputnik Wiki
Alloc( <size>, <flag> )
Contents |
Description
Allocate memory and return the pointer to it.
Parameters
size
Size in bytes to allocate.
flag
Optional; If higher than 0 the allocated memory will be zeroed.
Return Value
Success: Returns a valid pointer.
Failure: Returns 0.
Remarks
Using alloc etc its even possible to create your own memory based functions such as your own DLLStruct functions.
Example
$PTR = Alloc(300); PTRWrite($PTR, "f", 0, 133.77); PTRWrite($PTR, "l", 4, 777); PTRWrite($PTR, "i", 12, 1221); Println( PTRRead($PTR, "f", 0) ); Println( PTRRead($PTR, "l", 4) ); Println( PTRRead($PTR, "i", 12) ); Free($PTR);