putc writes to logical unit 6, normally the control terminal output.
fputc writes to a logical unit.
These functions write a character to the file associated with a FORTRAN logical unit bypassing normal FORTRAN I/O.
Do not mix normal FORTRAN output with output by these functions on the same unit.
|
INTEGER*4 putc status = putc( char ) |
|||
|---|---|---|---|
|
char |
character |
Input |
The character to write to the unit |
|
Return value |
INTEGER*4 |
Output |
status=0: OK status>0: System error code |
character char, s*10 / 'OK by putc' /
INTEGER*4 putc, status
do i = 1, 10
char = s(i:i)
status = putc( char )
end do
status = putc( '\n' )
end
demo% f77 -silent tputc.f
demo% a.out
OK by putc
demo%
|
INTEGER*4 fputc status = fputc( lunit,char ) |
|||
|---|---|---|---|
|
lunit |
INTEGER*4 |
Input |
The unit to write to |
|
char |
character |
Input |
The character to write to the unit |
|
Return value |
INTEGER*4 |
Output |
status=0: OK status>0: System error code |
character char, s*11 / 'OK by fputc' /
INTEGER*4 fputc, status
open( 1, file='tfputc.data')
do i = 1, 11
char = s(i:i)
status = fputc( 1, char )
end do
status = fputc( 1, '\n' )
end
demo% f77 -silent tfputc.f
demo% a.out
demo% cat tfputc.data
OK by fputc
demo%
See also putc(3S), intro(2), and perror(3F).