FGETC

Portability Function: Reads the next available character from a file specified by a Fortran unit number.

Module: USE DFPORT

Syntax

result = FGETC (lunit, char)

lunit
(Input) INTEGER(4). Unit number of a file.


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 is of type 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 Input and Output With Portability Routines in the Programmer's Guide.

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

See Also: GETCHARQQ, READ

Example

USE dfport
CHARACTER inchar
INTEGER istatus
istatus = FGETC(5,inchar)
PRINT *, inchar
END