gtpc2mdy | C/C++ Language Support User's Guide |
This function allows an application program to retrieve the contents of a binary large object (BLOB). TPF collection support (TPFCS) will allocate a malloc storage buffer and read the contents of the BLOB into the storage area. A pointer to the storage area will be returned to the caller with the current sequence counter value of the BLOB. The size that TPFCS reads is only limited by the amount of malloc storage available for allocation.
Format
#include <c$to2.h> void * TO2_getBLOB (const TO2_PID_PTR pid_ptr, TO2_ENV_PTR env_ptr, long *dataLength, long *sequenceCounter);
Normal Return
The normal return is a pointer to a buffer containing the requested data.
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_EMPTY
TO2_ERROR_ENV
TO2_ERROR_METHOD
TO2_ERROR_NOT_INIT
TO2_ERROR_PID
TO2_ERROR_STORAGE
TO2_ERROR_ZERO_PID
Programming Considerations
Examples
The following example retrieves the contents of a BLOB.
#include <c$to2.h> /* TO2 API function prototypes */ #include <stdio.h> /* APIs for standard I/O functions */ TO2_ENV_PTR env_ptr; /* Pointer to TO2 Environment */ TO2_PID blob; long seqCtr; /* field to hold sequence counter */ long dataLgh; /* field to hold length of BLOB */ char *bufPtr;
·
·
·
if ((bufPtr = (TO2_getBLOB(&blob, env_ptr, &dataLgh, &seqCtr)) == TO2_ERROR) { printf("TO2_getBLOB failed!\n"); process_error(env_ptr); } else { printf("TO2_getBLOB was successful!\n"); }
·
·
·
free(bufPtr);
Related Information