The mi_file_errno() function

The mi_file_errno() function returns the value of the system errno variable after a file input/output (I/O) operation. This value is the last errno value generated during an mi_file* function call and comes from the computer where the file is located. This function does not translate the value from one platform to another.

Syntax

mi_integer mi_file_errno()
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

File I/O functions of the C library call underlying system or platform file I/O functions. These system or platform functions set a global variable called errno to indicate status. For a list of DataBlade® API file-access functions, see the Informix® DataBlade® API Programmer's Guide.

These file-access functions call the corresponding C library functions to perform their tasks. Therefore, the value of the errno is available for a DataBlade® API module.

On UNIX or Linux, you can check the errno variable directly, immediately after a DataBlade® API file I/O function. Therefore, use of mi_file_errno() is not required for UNIX or Linux. In fact, the mi_file_errno() function on UNIX or Linux is the same as the errno variable.

If you plan to port a user-defined routine (UDR) or DataBlade® module to Windows, it is strongly recommended that you use the mi_file_errno() to retrieve the errno value.

On Windows, global variables, such as errno, are not easily accessible. Therefore, to obtain the errno value after a DataBlade® API file I/O operation, use the mi_file_errno() function. DataBlade® APIs and UDRs that execute on the Windows platform must use mi_file_errno() to access the errno for file operations.

Server only: This function can access the errno value only for a file that is on a server computer.

Return values

None.