putwc(S)
putwc, putwchar, fputwc --
put wide character on a stream
Syntax
cc . . . -lc
#include <stdio.h>
#include <wchar.h>
wint_t putwc(wint_t wc, FILE *stream);
wint_t putwchar(wint_t wc);
wint_t fputwc(wint_t wc, FILE *stream);
Description
fputwc(S)
converts the wide character wc to its
corresponding character and writes
the character to the output stream, stream.
The character is written to
the current file position (indicated by the file-position indicator)
if the file associated with the stream supports positioning.
The character is appended to
the output stream
if the file positioning is not supported by the file
or if the stream
was opened with append mode.
The file-position indicator is advanced appropriately when
the character is written.
If an error occurs during the writing,
the shift state of the output file is undefined.
If
fputwc( )
returns successfully
and a file is associated to stream, the st_ctime
and
st_mtime
fields of the file are marked for update and will
be updated when
fflush(S)
or
fclose(S)
is called the next time on stream successfully
or when
exit(S)
or
abort(S)
is called.
The call to
putwc(S)
is equivalent to a call to
fputwc( ),
except that
putwc( )
may be implemented as a macro and may evaluate stream
more than once. Use
fputwc( )
if the stream argument has side effects as in
fputwc(wc, *fp++),
or if the function name needs to be passed as an argument to another function.
The call putwchar(wc)
is equivalent to the call
putwc(wc, stdout).
Return values
Upon successful completion,
putwc( ),
putwchar( ),
and
fputwc( )
return wc. Otherwise,
WEOF is returned, an error indicator for the stream is set
and errno is set to indicate the error.
Diagnostics
These routines
will fail if either the stream is unbuffered or data in the
stream's buffer needs to be written, and:
[EAGAIN]-
Cannot write to the output stream immediately without blocking
the process, and
the O_NONBLOCK flag is set for the file descriptor associated with
stream.
[EBADF]-
Not a valid file descriptor open for writing.
[EFBIG]-
Maximum file size or the file size limit for the process is exceeded
in the attempt to write to a file.
[EILSEQ]-
The wide-character code wc is not a valid character.
[EINTR]-
The write operation was terminated by a signal before any data
was written.
[EIO]-
Cannot write to the controlling terminal.
This will happen when
the process is in an orphaned background process group and the
attempt by the process to write to its controlling terminal fails,
because the TOSTOP bit is set to disable the
writing and the SIGTTOU signal is not ignored or not blocked
by the process.
[ENOMEM]-
Insufficient storage space is available.
[ENOSPC]-
No free space left on the device where the file associated with
stream is stored.
[EPIPE]-
The pipe or FIFO being written to is not opened
by any process for reading.
This error will also send a SIGPIPE signal to the process.
[ENXIO]-
Attempt to write to a non-existent device, or to a
device whose capabilities are exceeded.
See also
ferror(S),
fflush(S),
fopen(S),
fstat(S),
setbuf(S),
ulimit(S)
Standards conformance
putwc(S),
putwchar(S),
and
fputwc(S)
are conformant with:
X/Open CAE Specification, System Interfaces and Headers,
Issue 4, 1992.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003