Writes a character or a word to a stream.
#include <stdio.h>
wint_t putwc(Character, Stream) wint_t Character; FILE *Stream;
wint_t putwchar(Character) wint_t Character;
wint_t fputwc(Character, Stream) wint_t Character; FILE Stream;
The putwc subroutine writes the wide character specified by the Character parameter to the output stream pointed to by the Stream parameter. The wide character is written as a multibyte character at the associated file position indicator for the stream, if defined. The subroutine then advances the indicator. 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 putwchar subroutine works like the putwc subroutine, except that putwchar writes the specified wide character to the standard output.
The fputwc subroutine works the same as the putwc subroutine.
Output streams, with the exception of stderr, are buffered by default if they refer to files, or line-buffered if they refer to terminals. The standard error output stream, stderr, is unbuffered by default, but using the freopen subroutine causes it to become buffered or line-buffered. Use the setbuf subroutine to change the stream's buffering strategy.
After the fputwc, putwc, fputc. putc, fputs, puts, or putw subroutine runs successfully, and before the next successful completion of a call either to the fflush or fclose subroutine on the same stream or to the exit or abort subroutine, the st_ctime and st_mtime fields of the file are marked for update.
Character | Specifies a wide character of type wint_t. |
Stream | Specifies a stream of output data. |
Upon successful completion, the putwc, putwchar, and fputwc subroutines return the wide character that is written. Otherwise WEOF is returned, the error indicator for the stream is set, and the errno global variable is set to indicate the error.
If the putwc, putwchar, or fputwc subroutine fails because the stream is not buffered or data in the buffer needs to be written, it returns one or more of the following error codes:
These subroutines are part of Base Operating System (BOS) Runtime.
Other wide character I/O subroutines: fgetwc subroutine, fgetws subroutine, fputws subroutine, getwc subroutine, getwchar subroutine, getws subroutine, putws subroutine, ungetwc subroutine.
Related standard I/O subroutines: fdopen subroutine, fgets subroutine, fopen subroutine, fprintf subroutine, fputc subroutine, fputs subroutine, fread subroutine, freopen subroutine, fwrite subroutine, gets subroutine, printf subroutine, putc subroutine, putchar subroutine, puts subroutine, putw subroutine, sprintf subroutine.
National Language Support Overview for Programming, Subroutines Overview, Understanding Wide Character Input/Output Subroutines in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.