FORTRAN Reference Manual

Intrinsic Functions
FORTRAN Reference Manual528615-001
8-17
ICHAR Function
Example of the FILENUM Function
The following example uses the FILENUM function to disable the echo on a terminal:
?GUARDIAN SETMODE
CHARACTER * 10 s
OPEN (UNIT = 4)
10 CONTINUE
C Disable echo and do a READ with PROMPT = >:
CALL setmode (FILENUM (4), 20, 0)
READ (UNIT = 4, FMT = 1000, PROMPT= '>', END = 20) s
1000 FORMAT (A10)
.
C Leave the terminal with echo enabled!!!
20 CALL setmode (FILENUM (4), 20, 1)
STOP
END
ICHAR Function
The ICHAR function converts a character datum to an integer which represents the
characters position in the ASCII collating sequence, as shown in Appendix A, ASCII
Character Set.
The table below shows the argument and function type for the ICHAR generic function
and its associated specific functions.
Considerations
The result of the ICHAR function is always in the range
0 ICHAR (c) 255
The ICHAR function is the inverse of the CHAR function.
Syntax Argument Type Function Type
ICHAR (c) Character*1 Integer
ICHAR4 (c) Character*1 Integer*4
ICHAR8 (c) Character*1 Integer*8
c is a character expression with a length of one.