IERRNO

Portability Function: Returns the number of the last detected error from any routines in the DFPORT module that return error codes.

Module: USE DFPORT

Syntax

result = IERRNO( )

Results:

The result is of type INTEGER(4). The result value is the last error code from any portability routines that return error codes. These error codes are analogous to errno on a U*X system. The module DFPORT.F90 (in \DF98\INCLUDE) provides parameter definitions for the following Unix errno names (typically found in errno.h on U*X systems):

Symbolic name Number Description
EPERM 1 Insufficient permission for operation
ENOENT 2 No such file or directory
ESRCH 3 No such process
EIO 5 I/O error
E2BIG 7 Argument list too long
ENOEXEC 8 File is not executable
ENOMEM 12 Not enough resources
EACCES 13 Permission denied
EXDEV 18 Cross-device link
ENOTDIR 20 Not a directory
EINVAL 22 Invalid argument

The value returned by IERRNO is updated only when an error occurs. For example, if an error occurs on a GETLOG call and then two CHMOD calls succeed, a subsequent call to IERRNO returns the error for the GETLOG call.

Examine IERRNO immediately after returning from a Portability routine. Other Fortran routines, as well as any Win32 APIs, can also change the error code to an undefined value. IERRNO is set on a per thread basis.

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

Example

USE DFPORT
CHARACTER*20 username
INTEGER(4) ierrval
ierrval=0 !initialize return value
CALL GETLOG(username)
IF (IERRNO( ) == ierrval) then
  print *, 'User name is ',username
  exit
ELSE
  ierrval = ierrno()
  print *, 'Error is ',ierrval
END IF