Sun Studio 12: Fortran ライブラリ・リファレンス

1.4.52.2 isatty: 装置が端末であるかどうかの確認

関数 isatty は、論理装置 lunit が端末装置かどうかによって、true または false を返します。

関数は、次のように呼び出します。

terminal = isatty( lunit )

lunit

INTEGER*4

入力 

論理装置 

戻り値 

LOGICAL*4

出力 

terminal = 真: 端末デバイスである

terminal = 偽: 端末デバイスではない

例: lunittty であるかどうかを確認します。


       character*12 name, ttynam
       INTEGER*4 lunit /5/
       logical*4 isatty, terminal
       terminal = isatty( lunit )
       name = ttynam( lunit )
       write(*,*) '端末 = ', terminal, ', 名前 = "', name, '"'
       end

出力は次のように表示されます。


 端末 = T, 名前 = "/dev/ttyp1  "