TutPtrAryItemExists verify that the item exists in a pointer array
ptr_ary
pointer array where item
is looked for
item
item to look for
TRUE
if the specified item is in the array, FALSE
otherwise.
None
TutPtrAryItemExists searches ptr_ary
for the first occurrence of the specified item.
None
This example verifies that a given item exists in the pointer array:
T_PTR_ARY ptr_ary; T_INT4 i, *int_ptr, *mark_ptr;/* create the pointer array with initial size of 30 */
ptr_ary = TutPtrAryCreate(30);/* fill it up with 25 entries */
for (i = 0; i < 25; i++) {/* allocate the space for the next element */
T_MALLOC(int_ptr, sizeof(T_INT4), T_INT4 *); *int_ptr = i;/* append the item to the array, ignore the index */
TutPtrAryAppend(ptr_ary, int_ptr, NULL); if (i == 13) { mark_ptr = int_ptr; } }/* perform various pointer array operations */
. . . if (TutPtrAryItemExists(ptr_ary, mark_ptr)) { TutOut("Marked item is still in the array \n"); } else { TutOut("Marked item has been removed from the array \n"); }
TIBCO SmartSockets™ Utilities Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |