Visible to Intel only — GUID: GUID-DC0C4AE8-BA0C-4967-93F3-B66A75BA31B5
Visible to Intel only — GUID: GUID-DC0C4AE8-BA0C-4967-93F3-B66A75BA31B5
FPUTC
Portability Function: Writes a character to the file specified by a Fortran external unit, bypassing normal Fortran input/output.
USE IFPORT
result = FPUTC (lunit,char)
lunit |
(Input) INTEGER(4). Unit number of a file. |
char |
(Output) Character*(*). Variable whose value is to be written to the file corresponding to lunit. |
The result type is INTEGER(4). The result is zero if the write was successful; otherwise, an 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 Routines in Overview of Portability Routines.
use IFPORT
integer*4 lunit, i4
character*26 string
character*1 char1
lunit = 1
open (lunit,file = 'fputc.dat')
do i = 1,26
char1 = char(123-i)
i4 = fputc(1,char1) !make valid writes
if (i4.ne.0) iflag = 1
enddo
rewind (1)
read (1,'(a)') string
print *, string