The mi_set_varlen() function
The mi_set_varlen() accessor routine sets the length of the data in a varying-length structure (such as mi_lvarchar).
Syntax
void mi_set_varlen(varlen_ptr, data_len)
mi_lvarchar *varlen_ptr;
mi_integer data_len;
- varlen_ptr
- A pointer to the varying-length structure.
- data_len
- The length of the data to store in the varying-length descriptor.
Valid in client LIBMI application? | Valid in user-defined routine? |
---|---|
Yes | Yes |
Usage
- Before a call to the mi_set_vardata() or mi_set_vardata_align() function to tell these functions how many bytes of data to store
- When you set your own data portion with mi_set_varptr() to set the data length in a user-allocated data portion
The mi_set_varlen() function sets the data length in the varying-length descriptor. If you specify a data length larger than the current data portion, this function does not reallocate the data portion. Therefore, when you change the data length with mi_set_varlen(), make sure that the new value does not exceed the size of the data portion.
The data in a varying-length structure is not null terminated. Make sure that you use mi_set_varlen() to set the length of the actual varying-length data, not including any null terminator.
Although the varlen_ptr argument is declared as a pointer to an mi_lvarchar value, you can also use the mi_set_varlen() function to set data length in other varying-length data types, such as mi_sendrecv.
For information about when to set the length of a varying-length structure, see the Informix® DataBlade® API Programmer's Guide.
Return values
None.