|
|
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.
long
tptypes(char *ptr, char *type, char *subtype)
The following table describes the arguments to the tptypes() function.
tptypes() Function Arguments
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
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|