The mi_streamread_string() function

The mi_streamread_string() function reads an mi_string (CHAR(x)) value from a stream.

Syntax

mi_integer mi_streamread_string(stream, str_data, fparam_ptr)
   MI_STREAM *stream;
   mi_string **str_data;
   MI_FPARAM *fparam_ptr;
stream
A pointer to the stream descriptor for the open stream from which to read the character string.
str_data
A pointer to the buffer into which to copy the address of the character string.
fparam_ptr
A pointer to the MI_FPARAM structure for the user-defined routine that calls mi_streamread_string().
Valid in client LIBMI application? Valid in user-defined routine?
No Yes

Usage

The mi_streamread_string() function reads an mi_string value (or other character string) from the stream that stream references. The function reads the mi_string value from the stream, puts the address of the value in the buffer that *str_data references, and allocates memory for the buffer in the current memory duration. The read operation begins at the current stream seek position. You can use mi_stream_tell() or mi_stream_getpos() to obtain this seek position.

The mi_streamread_string() function is useful in a streamread() support function of an opaque data type that contains an mi_string value.

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

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

Return values

>=0
The number of bytes that the function has read from the open stream to the value that stream references.
MI_STREAM_EEOF
The end of the stream has been reached without any errors.
MI_STREAM_EBADARG
The stream descriptor that stream references or the value that str_data references is invalid.
MI_ERROR
The function was not successful.