The stream-operations structure contains pointers to the
C functions that implement the generic stream I/O functions for the
particular stream. A valid stream-operations structure must exist
for the DataBlade®
API to
locate at run time your type-specific implementations of these generic
stream I/O functions. Therefore, it must be initialized before the
call to mi_stream_init().
The following code fragment shows the declaration of the stream-operations
structure, mi_st_ops. For the most current definition, see
the mistream.h header file.
As preceding code fragment shows, the stream-operations structure
consists of the following parts:
The function pointers to the generic stream I/O functions
The names of the generic stream I/O functions
The function handles of the generic stream I/O functions
You must initialize the pointers and names and set the handles
to NULL.
The following code fragment shows a sample stream-operations structure
that provides function pointers for the type-specific implementations
of the mi_stream_close(), mi_stream_read(),
and mi_stream_write() functions for a stream on a user-defined
type named newstream. Figure 1: A sample stream-operations structure
The preceding code fragment statically initializes the stream-operations
structure. If you initialize this structure dynamically, do so in
the stream-open function.