From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/io%2Ffputwc.html | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 devdocs/c/io%2Ffputwc.html (limited to 'devdocs/c/io%2Ffputwc.html') diff --git a/devdocs/c/io%2Ffputwc.html b/devdocs/c/io%2Ffputwc.html new file mode 100644 index 00000000..c309e8f7 --- /dev/null +++ b/devdocs/c/io%2Ffputwc.html @@ -0,0 +1,63 @@ +

fputwc, putwc

Defined in header <wchar.h>
wint_t fputwc( wchar_t ch, FILE* stream );
+
(1) (since C95)
wint_t putwc( wchar_t ch, FILE* stream );
+
(2) (since C95)

Writes a wide character ch to the given output stream stream.

+
+2) May be implemented as a macro and may evaluate stream more than once.

Parameters

+ + +
ch - wide character to be written
stream - the output stream

Return value

Returns a copy of ch on success.

+

On failure, returns WEOF and sets the error indicator (see ferror()) on stream.

+

If an encoding error occurred, additionally sets errno to EILSEQ.

+

Example

#include <errno.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wchar.h>
+ 
+int main(void)
+{
+    setlocale(LC_ALL, "en_US.utf8");
+ 
+    errno = 0;
+    if (fputwc(L'🍌', stdout) == WEOF)
+    {
+        if (errno == EILSEQ)
+            puts("Encoding error in fputwc.");
+        else
+            puts("I/O error in fputwc.");
+        return EXIT_FAILURE;
+    }
+}

Possible output:

+
🍌

References

See also

+ + + +
writes a character to a file stream
(function)
+
(C95)
writes a wide string to a file stream
(function)
+
(C95)
gets a wide character from a file stream
(function)
C++ documentation for fputwc
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/io/fputwc +

+
-- cgit v1.2.3