OpenTP1 Version 7 Programming Reference C Language
tptypes - Determine information about a typed buffer
Format
ANSI C, C++
#include <xatmi.h> long tptypes (char *ptr, char *type, char *subtype) |
K&R C
#include <xatmi.h> long tptypes (ptr, type, subtype) char *ptr; char *type; char *subtype; |
Description
The function tptypes() takes as its first argument a pointer to a data buffer and returns the type and subtype of that buffer in its second and third arguments, respectively. ptr must point to a buffer obtained from tpalloc(). If type and subtype are non-NULL, the function populates the character arrays to which they point with the names of the buffer's type and subtype, respectively. If the names are of their maximum length (8 for type, 16 for subtype), the character array is not null-terminated. If no subtype exists, then the array pointed to by subtype contains a NULL string ("").
Note that only the first eight bytes of type and the first 16 bytes of subtype are populated.
<<Arguments>>
<<ptr
Specify the pointer to the buffer.>>
<<type
Specify the pointer to the buffer type.>>
<<subtype
Specify the pointer to the buffer subtype.>>
Return value
Upon success, tptypes() returns the size of the buffer. Otherwise, it returns -1 upon failure and sets tperrno to indicate the error condition.
Errors
Under the following conditions, tptypes() fails and sets tperrno to one of the following values:
Return value | Return value (numeric) | Explanation |
---|---|---|
TPEINVAL | 4 | Invalid arguments were given (for example, ptr is not a pointer to a typed buffer). |
TPEPROTO | 9 | tptypes() was called in an improper context. |
TPESYSTEM | 12 | A communication resource manager system error has occurred. The exact nature of the error is determined in a product-specific manner. |
TPEOS | 7 | An operating system error has occurred. The exact nature of the error is determined in a product-specific manner. |
See also
tpalloc(), tpfree(), tprealloc().
<<Notes on use with OpenTP1>>
All Rights Reserved. Copyright (C) 2006, 2010, Hitachi, Ltd.