Futurebasic/Language/Reference/def dynamicremoveitems

DEF DYNAMICREMOVEITEMS Statement edit

DEF DYNAMICREMOVEITEMS edit

Statement edit

✔ Appearance ✔ Standard ✔ Console

Syntax edit

DEF DYNAMICREMOVEITEMS ( gMyDynamicArray, First&, HowMany&, SavePtr& )

Revised edit

November 2006 (FB 4, Release 4)

Description edit

This function deletes HowMany& items from gMyDynamicArray, beginning with item First&. Any subsequent items will shift down to replace the removed items, resulting in an array of HowMany& fewer items. Each subsequent item will have its index reduced by HowMany&. If SavePtr& is 0, the data will be expunged without warning or recourse. If a pointer is passed in SavePtr&, the data to be removed will first be copied to that address.

Note edit

Whether currently populated or not, a dynamic array must have held data at some point before being passed to this function.

gMyDynamicArray is any FutureBASIC Dynamic Array previously dimensioned using DYNAMIC or DIMÊDYNAMIC.

First& is the array position of the first item to be removed. It must be >= 0. DEFÊDYNAMICREMOVEITEMS will not remove more items than exist in the array. For example, if your array holds 10 items (0-9) and you attempt to remove 5 items beginning with item 8, 2 items (8-9) will be removed instead and the array will be left with 8 items (0-7).

HowMany& specifies the number of contiguous items to be removed. If there are too few items following First&, only the number available will be removed. SavePtr& is an address to which the items being removed from gMyDynamicArray will be copied.

SavePtr& must point to an allocated memory block (or variable) of adequate size to hold all data being removed. DEFÊDYNAMICREMOVEITEMS does not check to ensure there is adequate space. If there are fewer than HowMany& items available to remove, only the number removed will be copied to SavePtr&. To remove data without saving it, pass 0 in SavePtr&.

See Also edit

DEF DYNAMICINSERTITEMS; DYNAMIC; USR DYNAMICITEMSIZE