Portability Function: Reads the next available character from a file specified by a Fortran unit number.
Module: USE IFPORT
Syntax
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.
Results
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 Building Applications: Portability Routines: Input and Output Routines.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
See Also
Example
USE IFPORT
CHARACTER inchar
INTEGER istatus
istatus = FGETC(5,inchar)
PRINT *, inchar
END