TutPtrAryAppend append an item to a pointer array
T_BOOL TutPtrAryAppend(ptr_ary, pointer, index_return
) T_PTR_ARYptr_ary
; T_PTRpointer
; T_INT4 *index_return
;
ptr_ary
pointer array to which the new element should be appended.
pointer
element to be appended to the specified pointer array.
index_return
pointer to optional storage for the index of the newly appended element in the array. This argument may be NULL
.
Returns TRUE
if operation is a success, FALSE
otherwise.
None
TutPtrAryAppend appends a new element to ptr_ary
. During this operation, ptr_ary
may be resized to create space for the new element. index_return
is an optional argument that, if used, contains the index of the newly appended element in the array upon the successful completion of the operation.
TutPtrAryAppend calls the pointer array change callbacks with the reason T_PA_ITEM_INSERTED.
Allocate memory for index_return
before calling TutPtrAryAppend.
This example appends an item to a pointer array:
T_PTR_ARY ptr_ary; T_INT4 i, *int_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); }
TIBCO SmartSockets™ Utilities Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |