ListGetData

Top  Previous  Next

Syntax

POINTER = ListGetData(pos as POINTER)

Description

Retrieves the data pointer from a node in a linked list

Parameters

pos - A node pointer returned by ListGetFirst or ListGetNext

Return value

A pointer to the data added with ListAdd or ListAddHead

Remarks

Its important to remember the relationship between a node and a data pointer. The node is create by adding data to the list, the data is a pointer supplied by you to some arbitrary information you wish to store in the linked list. ListGetFirst and ListGetNext return the pointer to the node and ListGetData returns a pointer to your data stored in that node.

See Also: ListGetFirst, ListGetNext, ListAdd, ListAddHead

Example usage

pos = ListGetFirst(mylist)
WHILE pos <> 0
     data = ListGetData(pos)
     PRINT #<INT>data,
     pos = ListGetNext(pos)
ENDWHILE