miopen_volume(const char *path, int mode, mihandle_t *hvol);
The path argument gives the absolute or relative pathname of the file to be accessed.
The mode argument controls whether the file is opened for read
access only
(MI2_OPEN_RDONLY),or for both read and write access (MI2_OPEN_RDWR).
The file ``handle'', which must be used in subsequent operations on the file, is returned in the hvol argument.
Once your program is finished using the file, it should close the file
and release the file handle by calling:
miclose_volume(mihandle_t hvol);
Here is an example showing the use of these two functions:
#include <minc2.h> main() { int result; mihandle_t hvol; result = miopen_volume("/home/sparky/test.mnc", MI_OPEN_RDONLY, &hvol); if (result != MI_NOERROR) { fprintf(stderr, "Error opening the input file.\n"); } /* Work with the file here. */ miclose_volume(hvol); }