FPUTC — Write a single character in stream mode#
-
FPUTC(UNIT, C)#
Write a single character in stream mode 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.
- Parameters:
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.
- Standard:
GNU extension
- Class:
Subroutine, function
- Syntax:
CALL FPUTC(UNIT, C [, STATUS]) STATUS = FPUTC(UNIT, C)
- Example:
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
- See also:
FPUT — Write a single character in stream mode to stdout, FGET — Read a single character in stream mode from stdin, FGETC — Read a single character in stream mode