ListInsertInOrder
int ListInsertInOrder (ListType list, const void *pointerToItem, CompareFunction compareFunction);
Purpose
This function inserts a copy of an item into a list at the correct position needed to maintain a sorted order.
The list must already be in sorted order or the results are undefined.
The item pointed to by pointerToItem should be the same size as the item size specified when the list was created.
Parameters
Input | ||
Name | Type | Description |
list | ListType | The list to insert the item into. |
pointerToItem | const void * | The pointer to the item to insert. |
compareFunction | CompareFunction | A comparison function which will be used to compare the item to the items already in the list so that it may be inserted at the correct position. The compare function should have the following prototype: int CVICALLBACK CompareFunction(void *item1, void *item2); The compare function should return a negative number if item1 is less than item2, it should return 0 if item1 is equal to item2, and it should return a positive number is item1 is greater than item2. If zero (0) is passed for the compare function, the C Library function memcmp will be called to compare items. This instrument driver provides several commonly useful comparison functions: ShortCompare IntCompare FloatCompare DoubleCompare CStringCompare CStringNoCaseCompare |
Return Value
Name | Type | Description |
result | int | Returns non–zero if the item was inserted. Returns zero (0) if there is not enough memory or if bad arguments are passed to the function. |
Additional Information
Library: Programmer's Toolbox
Include file: toolbox\toolbox.h
LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later