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

SutCopyList

Returns a pointer to a SutList structure, which is a copy of the supplied list parameter.

Synopsis

#include "SutList.h"
pSutList SutCopyList(pSutList p);

Arguments

p
A pSutList, a pointer to a SutList structure, the source list in the copy operation.

Return Values

Returns a pSutList, a pointer to a SutList structure, which is a copy of the supplied list parameter. Returns NULL if p is NULL.

Description

SutCopyList returns a pSutList, which is a pointer to a SutList structure. The return value is a copy of the supplied parameter. Returns NULL if p is NULL. 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. The list must be deallocated with SutDeleteList() or SutDestroyList().

Note: The same elements are now members of both lists. Be careful of deallocating elements from one list while they are still members of the other list.

Example

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

See Also



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

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