Obtain a valid LO-status structure
The mi_lo_stat() function is the constructor
for the LO-status structure. The third argument to the mi_lo_stat() function
indicates whether to create a LO-status structure:
- When you pass a NULL-valued pointer, the mi_lo_stat() function
allocates a new LO-status structure. Server only: This LO-status structure has the current memory duration.
- When you pass a pointer that does not point to NULL, the mi_lo_stat() function
assumes that the pointer references an existing LO-status structure
that a previous call to mi_lo_stat() has allocated.
An LO-status pointer that does not point to NULL allows a DataBlade API module to reuse an LO-status structure.
For example, the following code fragment uses the mi_lo_stat() function
to allocate memory for the LO-status structure only when the first_time flag
is true.
Figure 1. Sample
mi_lo_stat() call
MI_CONNECTION *conn;
MI_LO_HANDLE *LO_hdl;
MI_LO_STAT *LO_stat;
MI_LO_FD LO_fd;
mi_integer first_time;
...
LO_fd = mi_lo_open(conn, LO_hdl, MI_LO_RDONLY);
if ( first_time )
{
...
LO_stat = NULL; /* tell interface to allocate memory */
first_time = 0; /* set "first_time" flag to false */
...
}
err = mi_lo_stat(conn, LO_fd, &LO_stat);