FGET(3f)

DESCRIPTION
Read a single character in stream mode from stdin by bypassing normal formatted output. Stream I/O should not be mixed with normal record-oriented (formatted or unformatted) I/O on the same unit; the results are unpredictable.

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.

STANDARD
GNU extension

CLASS
Subroutine, function

SYNTAX

CALL FGET(C [, STATUS]) STATUS = FGET(C)

ARGUMENTS

C The type shall be CHARACTER and of default kind. STATUS (Optional) status flag of type INTEGER. Returns 0 on success, -1 on end-of-file, and a system specific positive error code otherwise.

EXAMPLE
          PROGRAM test_fget
            INTEGER, PARAMETER :: strlen = 100
            INTEGER :: status, i = 1
            CHARACTER(len=strlen) :: str = ""

            WRITE (*,*) 'Enter text:'
            DO
              CALL fget(str(i:i), status)
              if (status /= 0 .OR. i > strlen) exit
              i = i + 1
            END DO
            WRITE (*,*) TRIM(str)
          END PROGRAM

SEE ALSO
FGETC, FPUT, FPUTC

AUTHOR

This information was taken from the GFortran documentation (https://gcc.gnu.org/onlinedocs/gcc-5.3.0/gfortran/) and converted to a manpage by AstroFloyd (http://astrofloyd.org).