gtpc2mbmC/C++ Language Support User's Guide

TO2_getErrorText-Retrieve the Associated Error Text

This function retrieves the associated error text for a TPFCS error code.

Format

#include <c$to2.h>
TO2_ERR_TEXT_PTR TO2_getErrorText (const TO2_ENV_PTR env_ptr,
                                   const TO2_ERR_CODE err_code);

env_ptr
The pointer to the environment used on the call that returned the error.

err_code
The field that contains the error code value returned by the TO2_getErrorCode function.

Normal Return

The normal return is a pointer to a NULL delimited text string. The character value at pointer address -1 is the length of the text string not including the NULL delimiter.

Error Return

Not applicable.

Programming Considerations

None.

Examples

The following example retrieves the error code text associated with an error code value returned by TPFCS.

#include <c$to2.h>                /* Needed for TO2 API functions     */
#include <stdio.h>                /* APIs for standard I/O functions  */
 
TO2_ENV_PTR    env_ptr;           /* PTR to the TO2 environment       */
TO2_PID        collect;           /* will hold collection's PID       */
TO2_ERR_CODE     err_code;        /* TO2 error code value             */
TO2_ERR_TEXT_PTR err_text_ptr;    /* TO2 error code text pointer      */
long           entryLength=100;   /* set to entry length              */

  ·
  ·
  ·
if (TO2_createArray(&collect, env_ptr, &entryLength) == TO2_ERROR) { printf("TO2_createArray failed!\n"); err_code = TO2_getErrorCode(env_ptr); err_text_ptr = TO2_getErrorText(env_ptr, err_code); printf("err_text_ptr is %s\n", err_text_ptr); } else printf("TO2_createArray successful!\n");

Related Information

TO2_getErrorCode-Retrieve the Error Code Value.