Home | Previous Page | Next Page   Function Descriptions >

mi_streamread_decimal( )

The mi_streamread_decimal( ) function reads an mi_decimal (DECIMAL) value from a stream, converting any difference in the stream representation to that of the internal representation.

Syntax

mi_integer mi_streamread_decimal(strm_desc, dec_dptr)
   MI_STREAM *strm_desc;
   mi_decimal **dec_dptr;
strm_desc
is a pointer to the stream descriptor for the open stream from which to read the mi_decimal value.
dec_dptr
is a pointer to the buffer into which to copy the address of the mi_decimal value.
Valid in Client LIBMI Application? Valid in User-Defined Routine?
No Yes

Usage

The mi_streamread_decimal( ) function reads an mi_decimal value from the stream that strm_desc references. The function reads the mi_decimal value from the stream, puts the address of the value in the buffer that dec_dptr references, and allocates memory for the value 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.

When *dec_dptr points to NULL, mi_streamread_decimal( ) allocates the memory for the buffer in the current memory duration. Otherwise, the function assumes that you have allocated the memory that *dec_dptr references.

Important:
Be sure that *dec_dptr points to NULL if the parameter does not point to valid memory.

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

Return Values

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

Related Topics

See also the descriptions of mi_stream_getpos( ), mi_stream_read( ), mi_stream_tell( ), and mi_streamwrite_decimal( ).

For more information on the use of mi_streamread_decimal( ) in a streamread( ) support function, see the IBM Informix: DataBlade API Programmer's Guide.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]