gtpc2mbl | C/C++ Language Support User's Guide |
This function retrieves the error code value from the environment after a reported TPFCS error.
Format
#include <c$to2.h> TO2_ERR_CODE TO2_getErrorCode (const TO2_ENV_PTR env_ptr);
Normal Return
The normal return is the error code from the environment.
Error Return
Not applicable.
Programming Considerations
Examples
The following example retrieves the error code value from a TPFCS environment.
#include <c$to2.h> /* Needed for TO2 API Functions */ #include <stdio.h> /* APIs for standard I/O functions */ TO2_PID cursor; TO2_ENV_PTR env_ptr; TO2_ERR_CODE err_code; /* TO2 error code value */ TO2_ERR_TEXT_PTR err_text_ptr; /* TO2 error code text pointer */
·
·
·
/**********************************************************************/ /* Increment cursor to point to next element in the collection. */ /**********************************************************************/ if (TO2_cursorPlus(&cursor, env_ptr) == TO2_ERROR) { err_code = TO2_getErrorCode(env_ptr); if (err_code != TO2_ERROR_EODAD) { printf("TO2_cursorPlus failed!\n"); process_error(env_ptr); } else printf("Cursor is already positioned at the last element.\n"); } else printf("TO2_atCursorPlus successful!\n");
The following example tests to see if the cursor is pointing at the end of the collection.
#include <c$to2.h> /* Needed for TO2 API Functions */ #include <stdio.h> TO2_PID cursor; TO2_ENV_PTR env_ptr; TO2_ERR_CODE err_code; /* TO2 error code value */
·
·
·
/**********************************************************************/ /* Is the cursor pointing to the end of the collection? */ /**********************************************************************/ if (TO2_atEnd(&cursor, env_ptr)) == TO2_IS_FALSE) { err_code = TO2_getErrorCode(env_ptr); if (err_code != TO2_IS_FALSE) { printf("TO2_atEnd failed!\n"); process_error(env_ptr); } else printf("Cursor is not pointing to the end of the collection.\n"); } else printf("Cursor is pointing to the end of the collection.\n");
Related Information