putwc()

Updated: April 19, 2023

Write a wide character to a stream

Synopsis:

#include <wchar.h>

wint_t putwc( wchar_t wc,
              FILE * fp );

Arguments:

wc
The wide character that you want to write.
fp
The stream that you want to write the wide character on.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The putwc() functions writes the wide character specified by wc, cast as (wint_t)(wchar_t), to the output stream specified by fp.

Returns:

The wide character written, cast as (wint_t)(wchar_t), or WEOF if an error occurred (errno is set).

Note: If wc exceeds the valid wide-character range, the value returned is the wide character written, not wc.

Errors:

EAGAIN
The O_NONBLOCK flag is set for fp, and the thread would have been blocked by this operation.
EBADF
The file descriptor for fp isn't valid for writing.
EFBIG
The file exceeds the maximum file size, or the function can't write at or beyond the offset maximum.
EINTR
A signal terminated the write operation; no data was transferred.
EIO
A physical I/O error has occurred or all of the following conditions were met:
  • The process is in the background.
  • TOSTOP is set.
  • The process is blocking/ignoring SIGTTOU.
  • The process group is orphaned.
EPIPE
An attempt was made to write to a pipe or FIFO that's closed; a SIGPIPE signal is also sent to the thread.

Classification:

ANSI, POSIX 1003.1

Safety:  
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread Yes