[Top] [Prev] [Next] [Bottom] [Contents]

SutRemoveList

Removes the last item of a SutList and returns it.

Synopsis

#include "SutList.h"
void* SutRemoveList(pSutList p);

Arguments

p
A pSutList.

Return Values

Returns the last item of the SutList. Returns NULL if passed a NULL value. Returns NULL if p is empty.

Description

SutRemoveList removes and returns the last item of a SutList. Returns NULL if passed a NULL p value or if the list is empty. The returned item is of type void*. You must typecast as appropriate to use the item.

The SutList structure and related functions manage a dynamically sized array of void pointers which can be used as a generic container for C/C++ programmers. Due to the implementation of the SutList, this is the most efficient way to removes items from a list.

Example

#include "SutList.h"
#include <stdio.h>
pSutList list;
int i, size;
char *str;
char* str1 = "Hello";
char* str2 = "World";
list = SutNewList();
SutAddList(list, str1);
SutAddList(list, str2);
size = SutSizList(list);
for (i=0; i<size; i++)
{
	str = (char*) SutRemoveList(list);
	fprintf(stderr, "%s\n", str);
}
SutDestroyList(list);

See Also



[Top] [Prev] [Next] [Bottom] [Contents]

info@bluestone.com
Copyright © 1997, Bluestone. All rights reserved.