gtpc2mhfC/C++ Language Support User's Guide

TO2_getListUsers-Get a List of Defined Users

This function returns a temporary sequence collection containing a list of all users defined to TPF collection support (TPFCS).

Format

#include <c$to2.h>
long  TO2_getListUsers (TO2_PID_PTR  pid_ptr,
                        TO2_ENV_PTR  env_ptr);

pid_ptr
The pointer to a field where the persistent identifier (PID) of the temporary collection will be returned.

env_ptr
The pointer to the environment as returned by the TO2_createEnv function.

Normal Return

The normal return is a positive value and the specified TO2_PID_PTR field contains the PID of the temporary sequence collection.

The sequence collection will contain an element in the following format for each user:

      struct TO2_listUsers_element
{
          u_long    userToken;         /* assigned user token
          char      userID[32];        /* user ID
          char      applID[32];        /* application ID
          TO2_PID   userPID;           /* user object PID
};

Error Return

An error return is indicated by a zero. When zero is returned, use the TO2_getErrorCode function to determine the specific error code. For more information, see Error Handling.

The following error codes are common for this function:

TO2_ERROR_ENV

TO2_ERROR_NOT_INIT

Programming Considerations

When the caller is done with the returned temporary collection, delete the collection by using the TO2_deleteCollection function.

Examples

The following example copies the class names for a collection.

#include <c$to2.h>                  /* Needed for TO2 API Functions    */
#include <stdio.h>                  /* APIs for standard I/O functions */
 
TO2_ENV_PTR      env_ptr;           /* Pointer to TO2 environment      */
TO2_PID          userListPID;       /* return area for PID             */
 
TO2_ERR_CODE     to2_rc=1;          /* return code receiver            */
TO2_ERR_TEXT_PTR err_textPtr;       /* TO2 error code text pointer     */

  ·
  ·
  ·
{ if ((to2_rc = TO2_getListUsers(&userListPidPtr, env_ptr)) == TO2_ERROR) { to2_rc = TO2_getErrorCode(env_ptr); err_textPtr = TO2_getErrorText(env_ptr, to2_rc); printf ("TO2_getListUsers failed, error code - %d\n ", to2_rc); printf ("persistent collections Error Text is %s\n ", err_textPtr); } else printf("persistent collections get user list was successful\n"); }

Related Information

None.