The mi_put_bytes() function

The mi_put_bytes() function copies the given number of bytes, converting any difference in alignment or byte order on the server computer to that of the client computer.

Syntax

mi_unsigned_char1 *mi_put_bytes (data_ptr, val_ptr, nbytes)
   mi_unsigned_char1 *data_ptr;
   char *val_ptr;
   mi_integer nbytes;
data_ptr
A pointer to the buffer to which to copy bytes of data.
val_ptr
A pointer to the buffer from which to copy bytes of data.
nbytes
The number of bytes to copy.
Valid in client LIBMI application? Valid in user-defined routine?
No Yes

Usage

The mi_put_bytes() function copies nbytes bytes from the buffer that val_ptr references to the user-defined buffer that data_ptr references. Upon completion, mi_put_bytes() 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 n is the length of the value that val_ptr identifies, the returned address is n bytes advanced from the original buffer address in data_ptr.

The mi_put_bytes() function is useful in a send support function of an opaque data type that contains byte data. Use this function to send untyped data (such as void *) within an opaque-type internal structure to a client application (which possibly has unaligned data buffers).

For more information about the use of mi_put_bytes() 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_ptr data buffer.
NULL
The function was not successful.