The mi_stream_close() function

The mi_stream_close() function closes a stream.

Syntax

mi_integer mi_stream_close(strm_desc)
   MI_STREAM *strm_desc;
strm_desc
A pointer to a stream descriptor for an open stream.
Valid in client LIBMI application? Valid in user-defined routine?
No Yes

Usage

The mi_stream_close() function closes the stream that strm_desc identifies. To close the stream, mi_stream_close() uses the stream-close function that the stream-operations structure contains.

When it closes a stream, mi_stream_close() also deallocates the MI_STREAM structure, unless the MI_STREAM structure was passed as an argument to mi_stream_init(). Calling mi_stream_close() to close a stream of a predefined stream class always deallocates the MI_STREAM structure; mi_stream_close() is the destructor function for a stream descriptor.
Important: The mi_stream_close() function can free a stream descriptor only if mi_stream_init() allocated it. If your user-defined stream-open function has allocated its own stream descriptor, mi_stream_close() does not free this descriptor.

Return values

MI_OK
The stream has been closed.
MI_STREAM_EBADARG
The stream descriptor that strm_desc references is invalid.
MI_STREAM_ENIMPL
The stream class does not implement the stream-close function.
MI_ERROR
The function was not successful.