|
perror |
将消息打印到 Fortran 逻辑单元 0 stderr。 |
|
gerror |
获取(上一次检测到的系统错误的)系统错误消息。 |
|
ierrno |
获取上一次检测到的系统错误的错误编号。 |
该子例程的调用方式如下所示:
|
call perror( string ) |
|||
|
string |
character*n |
输入 |
消息。它写在上一次检测到的系统错误的标准错误消息前面。 |
示例 1:
call perror( "file is for formatted I/O" ) |
该子例程或函数的调用方式如下所示:
|
call gerror( string ) |
|||
|
string |
character*n |
输出 |
上一次检测到的系统错误的消息 |
示例 2:gerror() 用作子例程:
character string*30
…
call gerror ( string )
write(*,*) string
|
示例 3:gerror() 用作函数;未使用 string:
character gerror*30, z*30
…
z = gerror( )
write(*,*) z
|
该函数的调用方式如下所示:
|
n = ierrno() |
|||
|
返回值 |
INTEGER*4 |
输出 |
上一次检测到的系统错误的编号 |
该数值只有在真正出现错误时才更新。可能会生成此类错误的大多数例程和 I/O 语句在调用之后会返回错误代码;该值能够比较可靠地反映导致出现错误状况的原因。
示例 4:ierrno():
INTEGER*4 ierrno, n
…
n = ierrno()
write(*,*) n
|
另请参见 intro(2) 和 perror(3)。
注意:
perror 调用中的 string 的长度不能超过 127 个字符。
gerror 返回的字符串长度由调用程序决定。
《Fortran 用户指南》中列出了 f95 的运行时 I/O 错误代码。