A pointer to a read-only wide-character string, where each character is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets, such as Unicode. The string is null-terminated, with the terminator being a `wchar_t` with value 0.
1st Parameter
Pointer to the null-terminated wide string to be written
2nd Parameter Type : FILE *
Pointer to FILE structure for file operations
2nd Parameter
Pointer to the file stream where the wide string will be written
Read more about parameters of fputws in parameters section
The fputwsfunction in C language Writes a wide-character string to a file stream.
The fputws function writes the wide-character string pointed to by ws to the stream. The terminating null wide character is not written. This function is useful for writing strings of wide characters to files or other output streams without formatting. It's particularly helpful when dealing with Unicode or other multibyte character encodings.
The fputwsfunction takes 2
parameters:
•
const wchar_t * `ws`: Pointer to the null-terminated wide string to be written
•
FILE * `stream`: Pointer to the file stream where the wide string will be written
Writes the wide string `ws` to the specified file stream. The string must be null-terminated. Returns a non-negative value on success, or `EOF` if an error occurs.
The fputws function return value :
Returns a non-negative value if successful, or EOF if a write error occurs
Output
This example demonstrates the basic usage of `fputws`. It writes a simple wide-character string to a file and checks for errors.