Intel® Fortran Compiler 17.0 Developer Guide and Reference
Portability Function: Reads the next available character from a file specified by a Fortran unit number.
USE IFPORT
result = FGETC (lunit,char)
lunit |
(Input) INTEGER(4). Unit number of a file. Must be currently connected to a file when the function is called. |
char |
(Output) CHARACTER*1. Next available character in the file. If lunit is connected to a console device, then no characters are returned until the Enter key is pressed. |
The result type is INTEGER(4). The result is zero if the read is successful, or -1 if an end-of-file is detected. A positive value is either a system error code or a Fortran I/O error code, such as:
EINVAL: The specified unit is invalid (either not already open, or an invalid unit number).
If you use WRITE, READ, or any other Fortran I/O statements with lunit, be sure to read Portability Routines.
USE IFPORT
CHARACTER inchar
INTEGER istatus
istatus = FGETC(5,inchar)
PRINT *, inchar
END