gtpc2mee | C/C++ Language Support User's Guide |
This function returns the state of the read-only attribute for the specified persistent identifier (PID).
Format
#include <c$to2.h> BOOL TO2_readOnly (const TO2_PID_PTR pid_ptr, TO2_ENV_PTR env_ptr);
Normal Return
Error Return
An error return is indicated by a zero return code. When zero is returned, use the TO2_getErrorCode function to determine the specific error code. For the TO2_IS_FALSE result, check the TPFCS error code by entering TO2_getErrorCode to distinguish this result from an error return indication. If the error code is zero, the Boolean result is false. Otherwise, an error is indicated and you can retrieve the error text by entering TO2_getErrorText. For more information, see Error Handling.
The following error codes are common for this function:
TO2_ERROR_ENV
TO2_ERROR_PID
Programming Considerations
This function does not use TPF transaction services on behalf of the caller.
Examples
The following example determines the read-only attribute of 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 blob;
·
·
·
if (TO2_ReadOnly(&blob, env_ptr) == TO2_ERROR) { err_code = TO2_getErrorCode(env_ptr); if (err_code == 0) { printf("TO2_ReadOnly successful!\n"); printf("Collection attribute IS NOT Read-Only \n"); { else { printf("TO2_Read_Only failed!\n"); process_error(env_ptr); } } else { printf("TO2_ReadOnly successful!\n"); printf("Collection attribute IS Read-Only \n"); }
·
·
·
Related Information