BEA Logo BEA Tuxedo Release 7.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy


   Tuxedo Doc Home   |   Programming   |   Topic List   |   Previous   |   Next   |   Contents

   Programming a BEA Tuxedo Application Using C

Checking for Buffer Type

The tptypes(3c) function returns the type and subtype (if one exists) of a buffer. The tptypes() function signature is as follows.

tptypes(char *ptr, char *type, char *subtype)

The following table describes the arguments to the tptypes() function.

tptypes() Function Arguments




Pointer to a data buffer. This pointer must have been originally allocated by a call to tpalloc() or tprealloc(), it may not be NULL, and it must be cast as a character type; otherwise, the tptypes() function reports an invalid argument error.


Pointer to the type of the data buffer. type is of character type.


Pointer to the subtype of the data buffer, if one exists. subtype is of character type. For all types other than VIEW, VIEW32, X_C_TYPE, and X_COMMON, upon return the subtype parameter points to a character array containing the NULL string.

Upon success, the tptypes() function returns the length of the buffer in the form of a long integer.

In the event of an error, tptypes() returns a value of -1 and sets tperrno(5) to the appropriate error code. For a list of these error codes, refer to the Introduction to the C Language Application-Transaction Monitor Interface, and tpalloc(3c) in the BEA Tuxedo C Function Reference.

You can use the size value returned by tptypes() upon success to determine whether the default buffer size is large enough to hold your data, as shown in the following example.

Getting Buffer Size

. . .
iptr = (FBFR *)tpalloc("FML", NULL, 0);
ilen = tptypes(iptr, NULL, NULL);
. . .
if (ilen < mydatasize)
iptr=tprealloc(iptr, mydatasize);

See Also