Home | Previous Page | Next Page   Function Descriptions >

mi_get_varlen( )

The mi_get_varlen( ) accessor function returns the length of the data stored in a varying-length structure (such as mi_lvarchar).

Syntax

mi_integer mi_get_varlen(varlen_ptr)
   mi_lvarchar *varlen_ptr;
varlen_ptr
is a pointer to a varying-length structure.
Valid in Client LIBMI Application? Valid in User-Defined Routine?
Yes Yes

Usage

The mi_get_varlen( ) function obtains the length of the varying-length data from the varying-length structure that varlen_ptr references. This returned length is the actual length of the varying-length structure. It does not include the length of the other fields of the varying-length structure.

Important:
The varying-length structure that "varlen_ptr" references is an opaque structure. Do not access the fields of this structure directly. Instead, use mi_get_varlen( ) to obtain the data length from this structure.

The data in a varying-length structure is not null terminated. Use the mi_get_varlen( ) function to obtain the data length, which you can then use to access the varying-length data.

Although the varlen_ptr argument is declared as a pointer to an mi_lvarchar, you can also use the mi_get_varlen( ) function to obtain data length from other varying-length data types, such as mi_sendrecv.

Return Values

>=0
is the length of the data in the variable-length structure.
MI_ERROR
indicates that the function was not successful.

Related Topics

See also the descriptions of mi_get_vardata( ), mi_get_vardata_align( ), mi_new_var( ), mi_set_varlen( ), and mi_var_free( ).

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]