The mi_put_string() function

The mi_put_string() function copies an mi_string (CHAR(x)) value to a buffer.

Syntax

mi_unsigned_char1 *mi_put_string(data_dptr, string_buf, srcbytes)
   mi_unsigned_char1 **data_dptr;
   mi_string *string_buf;
   mi_integer srcbytes;
data_dptr
A doubly indirected pointer to the buffer to which to copy the mi_string value.
string_buf
A pointer to the buffer from 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_put_string() function copies the mi_string value from the buffer that string_buf references into the buffer that data_dptr references.
Tip: While other mi_put functions accept a preallocated buffer, mi_put_string() allocates memory for data to be copied. This allocation is why a pointer to the address is passed.

Upon completion, mi_put_string() returns the address of the next position to which data can be copied in the data_ptr buffer. The function returns the data_ptr address advanced by nbytes bytes, ready for copying in the next value. In other words, if srcbytes is the length of the value that string_buf identifies, the returned address is srcbytes bytes advanced from the original buffer address in data_dptr.

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

For GLS, if code-set conversion is required, the mi_put_string() function converts the mi_string value from the code set of the server-processing locale to the code set of the client locale. For more information, see the Informix® GLS User's Guide.

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

Return values

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