Home | Previous Page | Next Page   Function Descriptions >

mi_stream_write( )

The mi_stream_write( ) function writes a specified number of bytes to an open stream.

Syntax

mi_integer mi_stream_write(strm_desc, buf, nbytes)
   MI_STREAM *strm_desc;
   void *buf;
   mi_integer nbytes;
strm_desc
is a pointer to a stream descriptor for an open stream.
buf
is a pointer to a user-allocated buffer, of at least nbytes bytes, that contains the data to write to the stream.
nbytes
is the maximum number of bytes to write to the stream.
Valid in Client LIBMI Application? Valid in User-Defined Routine?
No Yes

Usage

The mi_stream_write( ) function writes up to nbytes bytes to the open stream that strm_desc references. This functions copies the data to write to the stream from the buf user-defined buffer. The write operation begins at the current stream seek position. You can use mi_stream_tell( ) or mi_stream_getpos( ) to obtain this seek position.

Return Values

>=0
is the actual number of bytes that the function has written from the buf buffer to the open stream.

The actual number of bytes written might be less than the nbytes value.

MI_STREAM_EEOF
indicates that the end of the stream has been reached.
MI_STREAM_EBADARG
indicates that the stream structure that strm_desc references is invalid, the user-defined buffer is invalid, or the specified number of bytes is less than zero.
MI_STREAM_ENIMPL
indicates that the stream class does not implement the stream-write function.
MI_ERROR
indicates that the function was not successful.

Related Topics

See also the descriptions of mi_stream_open_fio( ), mi_stream_open_mi_lvarchar( ), mi_stream_open_str( ), mi_stream_read( ), mi_stream_seek( ), and mi_stream_tell( ).

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