The mi_stream_write() function

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
A pointer to a stream descriptor for an open stream.
buf
A pointer to a user-allocated buffer, of at least nbytes bytes, that contains the data to write to the stream.
nbytes
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 function 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
The number of bytes that the function has written from the buf buffer to the open stream.

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

MI_STREAM_EEOF
The end of the stream has been reached.
MI_STREAM_EBADARG
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
The stream class does not implement the stream-write function.
MI_ERROR
The function was not successful.