[Top] [Prev] [Next] [Bottom]
[Contents]
SutGetPosFromItem
Returns position of an item in a SutList.
#include "SutList.h"
int SutGetPosFromItem(pSutList p, void* item);
Arguments
- p
- A pSutList.
- item
- Specifies the item being looked up.
Return Values
Returns the position of an item in a SutList. Returns -1 if passed a NULL p
value. Returns -1, if the item is not in the list.
The item must be typecast appropriately in order to use the returned 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.
#include "SutList.h"
#include <stdio.h>
pSutList list;
int i;
char *str;
char* str1 = "Hello";
char* str2 = "World";
list = SutNewList();
SutAddList(list, str1);
SutAddList(list, str2);
i = SutGetPosFromItem(p, str1);
if (i>= 0)
{
str = (char*) SutRemoveNList(list, i);
fprintf(stderr, "%s\n", str);
}
SutDeleteList(list);
See Also
[Top] [Prev] [Next] [Bottom]
[Contents]
info@bluestone.com
Copyright © 1997, Bluestone. All rights
reserved.