ListRemove

Top  Previous  Next

Syntax

POINTER = ListRemove(pos as POINTER,OPT bDelete=0 as INT)

Description

Removes a node from a list.

Parameters

pos - Node to remove as returned by ListGetNext or ListGetFirst.

bDelete - Optional. If 1 then the DELETE function is called for the data pointer.

Return value

The next node in the list or NULL if this was the tail node.

Remarks

See Also: ListGetNext, ListGetFirst, ListRemoveAll

Example usage

'remove a data item
pos = ListGetFirst(mylist)
WHILE pos <> 0
     data = ListGetData(pos)
     IF #<INT>data = 5
          pos = ListRemove(pos,TRUE)
     ELSE
          pos = ListGetNext(pos)
     ENDIF
ENDWHILE