Specify a file name
The file name argument of mi_file_open() identifies the operating-system file to open. This file name is relative to the server computer. You can include an environment variable in the file name path for the mi_file_open() and mi_file_to_file() file-access functions. This environment variable must be set in the database server environment; that is, it must be set before the database server starts.
For example, the following code snippet shows an mi_file_open() call
that opens the operating-system file data_file1, which is in
the directory that the DATA_FILES environment
variable specifies.
Figure 1. Sample call to open an operating-system file
fd = mi_file_open("$DATA_FILES/data_file1",
O_WRONLY | O_APPEND | O_CREAT, 0644);
Suppose the DATA_FILES environment variable
is set to the following directory in the database server environment:
/usr/local/app/load_files
The call to mi_file_open() in Figure 1 opens the following file:
/usr/local/app/load_files/data_file1