4.3BSD/usr/man/man3/putc.3s

.\"	@(#)putc.3s	6.2 (Berkeley) 11/6/85
.\"
.TH PUTC 3S  "November 6, 1985"
.AT 3
.SH NAME
putc, putchar, fputc, putw \- put character or word on a stream
.SH SYNOPSIS
.B #include <stdio.h>
.PP
.B int putc(c, stream)
.br
.B char c;
.br
.SM
.B FILE
.B *stream;
.PP
.B int putchar(c)
.PP
.B int fputc(c, stream)
.br
.SM
.B FILE
.B *stream;
.PP
.B int putw(w, stream)
.br
.SM
.B FILE
.B *stream;
.SH DESCRIPTION
.I Putc
appends the character
.I c
to the named output
.IR stream .
It returns the character written.
.PP
.IR Putchar ( c )
is defined as 
.IR putc ( c ,
.BR stdout ).
.PP
.I Fputc
behaves like 
.IR putc ,
but is a genuine function rather than a macro.
.PP
.I Putw
appends word (that is,
.BR int )
.I w
to the output
.IR stream .
It returns the word written.
.I Putw
neither assumes nor causes special alignment in the file.
.SH "SEE ALSO"
fopen(3S),
fclose(3S),
getc(3S),
puts(3S),
printf(3S),
fread(3S)
.SH DIAGNOSTICS
These functions return the constant
.SM
.B EOF
upon error.  Since this is a good integer,
.IR  ferror (3S)
should be used to detect 
.I putw
errors.
.SH BUGS
Because it is implemented as a macro,
.I putc
treats a
.I stream
argument with side effects improperly.  In particular
.IP "putc(c, *f++);"
.PP
doesn't work sensibly.
.PP
Errors can occur long after the call to
.IR putc .