fputwc(3S) fputwc(3S)
NAME
fputwc, putwc, putwchar - put wide character code on a stream
SYNOPSIS
cc [flag ...] file ... -lw [library ...]
#include <stdio.h>
#include <wchar.h>
wintt fputwc(wintt wc, FILE *stream);
wintt putwc(wintt wc, FILE *stream);
wintt putwchar(wintt wc);
DESCRIPTION
The fputwc() function writes the character corresponding to the wide
character code wc to the output stream pointed to by stream, at the
position indicated by the associated file-position indicator for the
stream (if defined), and advances the indicator appropriately. If the
file cannot support positioning requests, or if the stream was opened
with append mode, the character is appended to the output stream.
The putwc() function is equivalent to fpuwc(), except that if it is
implemented as a macro it may evaluate stream more than once, so the
argument should never be an expression with side-effects. Because it
may be implemented as a macro, putwc() may treat a stream argument
with side-effects incorrectly. In particular, putwc(wc, *f++) may not
work correctly. Therefore, use of this function is not recommended;
the fputwc() function should be used instead.
The function call putwchar(wc) is equivalent to putwc(wc, stdout).
The stctime and stmtime fields of the file will be marked for update
between the successful execution of fputwc() and the next successful
completion of a call to fflush() or fclose() on the same stream or a
call to exit() or abort().
ERRORS
The following error code descriptions are function-specific. You will
find a general description in introprm2(2) or in errno(5).
The fputwc() function will fail if either the stream is unbuffered or
data in the streams buffer needs to be written, and:
EAGAIN The ONONBLOCK flag is set for the file descriptor underly-
ing stream and the process would be delayed in the write
operation.
EBADF The file descriptor underlying stream is not a valid
descriptor open for writing.
Page 1 Reliant UNIX 5.44 Printed 11/98
fputwc(3S) fputwc(3S)
EFBIG An attempt was made to write to a file that exceeds the max-
imum file size or the process file size limit [see
ulimit(2)].
EFBIG The file is a regular file and an attempt was made to write
at or beyond the offset maximum associated with the corres-
ponding stream.
EINTR The write operation was terminated due to the receipt of a
signal, and no data was transferred.
EIO A physical I/O error has occurred, or the process is a
member of a background process group attempting to write to
its controlling terminal, TOSTOP is set, the process is nei-
ther ignoring nor blocking SIGTOU and the process group of
the process is orphaned. This error may also be returned
under implementation-dependent conditions.
ENOSPC There was no free space remaining on the device containing
the file.
EPIPE An attempt is made to write a pipe or FIFO that is not open
for reading by any process. A SIGPIPE signal will also be
sent to the process.
The fgetwc() function will fail if:
ENOMEM Insufficient storage space is available.
ENXIO A request was made of a non-existent device, or the request
was outside the capabilities of the device.
EILSEQ The wide character code wc does not correspond to a valid
character.
RESULT
Upon successful completion, the fputwc() returns wc. Otherwise it
returns WEOF, sets an error indicator for the stream and errno is set
to indicate the error.
SEE ALSO
ferror(3S), fopen(3S), setbuf(3S), lfs(5), stdio(5), wchar(5).
Page 2 Reliant UNIX 5.44 Printed 11/98