FGETC— Read a single character in stream mode
This intrinsic is provided in both subroutine and function forms; however, only one form can be used in any given program unit.
Note that the
FGET intrinsic is provided for backwards compatibility
with g77. GNU Fortran provides the Fortran 2003 Stream facility.
Programmers should consider the use of new stream IO feature in new code
for future portability. See also Fortran 2003 status.
|UNIT||The type shall be |
|C||The type shall be |
|STATUS||(Optional) status flag of type |
PROGRAM test_fgetc INTEGER :: fd = 42, status CHARACTER :: c OPEN(UNIT=fd, FILE="/etc/passwd", ACTION="READ", STATUS = "OLD") DO CALL fgetc(fd, c, status) IF (status /= 0) EXIT call fput(c) END DO CLOSE(UNIT=fd) END PROGRAM