.TH putw() "" "" "STDIO Function (libc)"
.PC "Write word into stream"
.B "#include <stdio.h>"
\fBint putw(\fIword\^\fB, \fIfp\^\fB)\fR
\fBint \fIword\^\fB; FILE *\fIfp\^\fB;\fR
.PP
.B putw()
writes
.I word
into the file stream to which
.I fp
points.
.PP
.B putw()
differs from the related routine
.B putc()
in that
.B putw()
writes an
.BR int ,
whereas
.B putc()
writes a
.B char
that is promoted to an
.BR int .
.PP
By default,
.B putw()
returns the value written.
If an error occurs, it returns EOF.
You may need to call
.B ferror()
to distinguish this value from a genuine end-of-file flag.
.SH "See Also"
.Xr "ferror()," ferror
.Xr "libc" libc
.SH Notes
Because
.B putw()
is implemented as a macro as well as a function,
arguments with side effects may not work as expected.
The bytes of
.I word
are written in the natural byte order of the machine.
