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 (getwc, fgetwc, or getwchar Subroutine) subroutine, fgetws (getws or fgetws Subroutine) subroutine, fputws (putws or fputws Subroutine) subroutine, getwc (getwc, fgetwc, or getwchar Subroutine) subroutine, getwchar (getwc, fgetwc, or getwchar Subroutine) subroutine, getws (getws or fgetws Subroutine) subroutine, putws (putws or fputws Subroutine) subroutine, ungetwc subroutine.
Related standard I/O subroutines: fdopen (fopen, fopen64, freopen, freopen64 or fdopen Subroutine) subroutine, fgets (gets or fgets Subroutine) subroutine, fopen (fopen, fopen64, freopen, freopen64 or fdopen Subroutine) subroutine, fprintf (printf, fprintf, sprintf, wsprintf, vprintf, vfprintf, vsprintf, or vwsprintf Subroutine) subroutine, fputc (putc, putchar, fputc, or putw Subroutine) subroutine, fputs (puts or fputs Subroutine) subroutine, fread (fread or fwrite Subroutine) subroutine, freopen (fopen, fopen64, freopen, freopen64 or fdopen Subroutine) subroutine, fwrite (fread or fwrite Subroutine) subroutine, gets (gets or fgets Subroutine) subroutine, printf (printf, fprintf, sprintf, wsprintf, vprintf, vfprintf, vsprintf, or vwsprintf Subroutine) subroutine, putc (putc, putchar, fputc, or putw Subroutine) subroutine, putchar (putc, putchar, fputc, or putw Subroutine) subroutine, puts (puts or fputs Subroutine) subroutine, putw (putc, putchar, fputc, or putw Subroutine) subroutine, sprintf (printf, fprintf, sprintf, wsprintf, vprintf, vfprintf, vsprintf, or vwsprintf Subroutine) subroutine.
National Language Support Overview for Programming, Subroutines Overview, Understanding Wide Character Input/Output Subroutines in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.