1. drmaa2_list_get(3)
  2. DRMAA2
  3. drmaa2_list_get(3)

NAME

drmaa2_list_get - drmaa2_list_get, Returns a pointer to an element of the list.

SYNOPSIS

#include "drmaa2.h"

const void * drmaa2_list_get(const drmaa2_list list, const long pos);

DESCRIPTION

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.

RETURN VALUES

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.

EXAMPLE

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); 

SEE ALSO

drmaa2_list_create(3), drmaa2_list_free(3), drmaa2_list_add(3), drmaa2_list_del(3), drmaa2_list_size(3), drmaa2_list_has(3)

AUTHOR

Copyright Univa Corporation 2013

  1. Univa Corporation
  2. October 2013
  3. drmaa2_list_get(3)