Next: FRACTION, Previous: FPUT, Up: Intrinsic Procedures
FPUTC
— Write a single character in stream modeThis 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.
CALL FPUTC(UNIT, C [, STATUS])
UNIT | The type shall be INTEGER .
|
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.
|
PROGRAM test_fputc CHARACTER(len=10) :: str = "gfortran" INTEGER :: fd = 42, i OPEN(UNIT = fd, FILE = "out", ACTION = "WRITE", STATUS="NEW") DO i = 1, len_trim(str) CALL fputc(fd, str(i:i)) END DO CLOSE(fd) END PROGRAM