![]() |
|
The mi_file_open() function opens an operating-system file.
The mi_file_open() function opens the filename file in the access mode that open_flags specifies and the open mode that open_mode specifies. It returns an integer file descriptor to this open file, through which you access an operating-system file. The mi_file_open() function is the constructor function for a file descriptor. The mi_file_open() function allocates a new file descriptor for the duration of the client session.
The file ownership (owner and permissions) that open_mode specifies must be compatible with what open_flags specifies and what the operating-system open command supports.
From a C UDR, mi_file_open() can access files on the server computer. The function assumes the file ownership of the server environment.
In a client LIBMI application, mi_file_open() assumes the file ownership of the application user.
You can include environment variables in the filename path with the following syntax:
The mi_file_open() function passes the open_flags argument directly to the underlying operating-system call that opens a file. Therefore, the open_flags values must match those that your operating-system call supports.
>=0 | is the file descriptor for the file that mi_file_open() has opened. |
MI_ERROR | indicates that the function was not successful. |
The mi_file_open() function does not throw an MI_Exception event when it encounters a runtime error. Therefore, it does not cause callbacks to be invoked.
See the descriptions of the following functions: mi_file_allocate() and mi_file_close().
For more information, see Opening a File.