drmaa2_list_get
- drmaa2_list_get, Returns a pointer to an element of the list.
#include "drmaa2.h"
const void * drmaa2_list_get(const drmaa2_list list, const long pos);
Returns a pointer (not a copy) to an element of the given list at the given position. The function is independent of the list type. The returned element must be casted into the specific element type.
Returns NULL in case of an error or when there is no element on the given position. The error condition can be read out with drmaa2_lasterror(3) and drmaa2_lasterror_text(3). In case of success a pointer to the element is returned.
drmaa2_string_list strings = drmaa2_create_list(DRMAA2_STRINGLIST,
(drmaa2_list_entryfree) drmaa2_string_free);
drmaa2_list_add(strings, strdup("string one"));
drmaa2_list_add(strings, strdup("string two"));
const drmaa2_string string = (const drmaa2_string) drmaa2_list_get(strings, 0);
printf("First element of the list %s\n", (const char *) string);
drmaa2_list_free(&strings);
drmaa2_list_create(3), drmaa2_list_free(3), drmaa2_list_add(3), drmaa2_list_del(3), drmaa2_list_size(3), drmaa2_list_has(3)
Copyright Univa Corporation 2013