lrt_tptypes
| Buffer Manipulation Functions |
Determines information about a typed buffer.
long lrt_tptypes( char *ptr, char *type, char *subtype );
| ptr | Pointer to the buffer. |
| type | Buffer type. |
| subtype | Buffer subtype. |
The lrt_tptypes function determines information about a typed buffer.
Return Values
If the function succeeds, it returns the type, subtype and size of the buffer. If the function fails, it returns -1 and sets tperrno to indicate the error condition.
Parameterization
You cannot use standard parameterization for any arguments in this function.
Example
In the following example, the lrt_tptypes function returns the length of the buffer data_1. The retrieved buffer length is then sent to the output.
vuser_init()
{
char* data_0;
char* data_1;
long buflen;
int cd;
char string[] = "This is a string.";
data_0 = lrt_tpalloc("STRING", "", sizeof(string));
// Send a request, but cancel it afterwards
lrt_strcpy(data_0, string);
cd = lrt_tpacall("TOUPPER", data_0, 0, 0);
lrt_tpcancel(cd);
// Send a request, and look at reply
data_1 = lrt_tpalloc("STRING", "", 1024);
lrt_tpgetrply(&cd, &data_1, &olen, 0);
buflen = lrt_tptypes(data_1, type, NULL);
lr_output_message("The reply buffer type is %s, size is %lu.", type, buflen);
return 0;

