A data type used to represent wide characters, typically supporting larger character sets such as Unicode. Its size is platform-dependent but is often 2 or 4 bytes.
1st Parameter
The wide character to be written to the output stream.
2nd Parameter Type : FILE *
Pointer to FILE structure for file operations
2nd Parameter
Pointer to the `FILE` stream where the wide character is to be written.
Read more about parameters of putwc in parameters section
The putwcfunction in C language Writes a wide character to the specified stream.
The putwc function writes a wide character to the specified output stream at the current position. It's similar to fputwc but may be implemented as a macro. This function is used for writing wide characters to files or other streams, which is particularly useful for handling non-ASCII text and internationalization.
The putwcfunction takes 2
parameters:
•
wchar_t `wc`: The wide character to be written to the output stream.
•
FILE * `stream`: Pointer to the `FILE` stream where the wide character is to be written.
Writes the wide character `wc` to the specified output stream `stream`. Returns the character written as a `wint_t` on success or `WEOF` if an error occurs. Typically used for wide-character output to a file or standard output.
The putwc function return value :
Returns the wide character written as a wint_t value if successful, or WEOF if an error occurred
Output
This example demonstrates writing a wide character (Greek Omega) to a file using putwc. It shows proper error checking and locale setting.