These routines perform the following functions:
perror |
Print a message to FORTRAN logical unit 0, stderr. |
gerror |
Get a system error message (of the last detected system error) |
ierrno |
Get the error number of the last detected system error. |
call perror( string ) |
|||
---|---|---|---|
string |
character*n |
Input |
The message. It is written preceding the standard error message for the last detected system error. |
call perror( "file is for formatted I/O" )
The subroutine or function is called by:
call gerror( string ) |
|||
---|---|---|---|
string |
character*n |
Output |
Message for the last detected system error |
Example 2: gerror() as a subroutine:
character string*30 ... call gerror ( string ) write(*,*) string
Example 3: gerror() as a function; string not used:
character gerror*30, z*30 ... z = gerror( ) write(*,*) z
n = ierrno() |
|||
---|---|---|---|
Return value |
INTEGER*4 |
Output |
Number of last detected system error |
This number is updated only when an error actually occurs. Most routines and I/O statements that might generate such errors return an error code after the call; that value is a more reliable indicator of what caused the error condition.
INTEGER*4 ierrno, n ... n = ierrno() write(*,*) n
See also intro(2) and perror(3).
Note:
string in the call to perror cannot be longer than 127 characters.
The length of the string returned by gerror is determined by the calling program.
Runtime I/O error codes for f77 and f90 are listed in the Fortran User's Guide.