The mi_get_string() function

The mi_get_string() function copies an mi_string (CHAR(x)) value from a buffer.

Syntax

mi_unsigned_char1 *mi_get_string(data_ptr, string_dptr, srcbytes)
   mi_unsigned_char1 *data_ptr;
   mi_string **string_dptr;
   mi_integer srcbytes;
data_ptr
A pointer to the buffer from which to copy the mi_string value.
string_dptr
A pointer to the buffer to which to copy the mi_string value.
srcbytes
The number of source bytes to copy.
Valid in client LIBMI application? Valid in user-defined routine?
No Yes

Usage

The mi_get_string() function copies srcbytes bytes from the user-defined buffer that data_ptr references into the buffer that string_ptr references. Upon completion, mi_get_string() returns the address of the next position from which data can be copied from the data_ptr buffer. The function returns the data_ptr address advanced by srcbytes bytes, ready for a subsequent copy. In other words, if srcbytes is the length of the value in string_buf, the returned address is srcbytes bytes advanced from the original buffer address in data_dptr.

The mi_get_string() function is useful in a receive support function of an opaque data type that contains an mi_string value. Use this function to receive an mi_string field of an opaque-type internal structure from a client application (which possibly has unaligned data buffers).

If code-set conversion is required, the mi_get_string() function converts the mi_string value from the code set of the client locale to that of the serverprocessing locale. For more information, see the Informix® GLS User's Guide.

Tip: While other mi_get functions accept a preallocated buffer, mi_get_string() allocates memory for data to be copied. This allocation is why the function accepts a pointer to the address as the buffer argument.

For more information about the use of mi_get_string()_get_string() in a receive support function, see the Informix® DataBlade® API Programmer's Guide.

Return values

An mi_unsigned_char1 pointer
The new address in the data_ptr data buffer.
NULL
The function was not successful.