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%2Fputwchar.html | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 devdocs/c/io%2Fputwchar.html (limited to 'devdocs/c/io%2Fputwchar.html') diff --git a/devdocs/c/io%2Fputwchar.html b/devdocs/c/io%2Fputwchar.html new file mode 100644 index 00000000..9c73d395 --- /dev/null +++ b/devdocs/c/io%2Fputwchar.html @@ -0,0 +1,51 @@ +

putwchar

Defined in header <wchar.h>
wint_t putwchar( wchar_t ch );
+
(since C95)

Writes a wide character ch to stdout.

+

Parameters

+ +
ch - wide character to be written

Return value

ch on success, WEOF on failure.

+

Example

#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wchar.h>
+ 
+int main()
+{
+    setlocale(LC_ALL, "en_US.utf8");
+ 
+    const wchar_t data[] =
+    {
+        L'\u2200', // Unicode name: "FOR ALL"
+        L'∀',
+        L'\n',
+    };
+ 
+    for (size_t t = 0; t != (sizeof data / sizeof(wchar_t)); ++t)
+    {
+        if (putwchar(data[t]) == WEOF)
+        {
+            puts("I/O error in putwchar");
+            return EXIT_FAILURE;
+        }
+    }
+ 
+    return EXIT_SUCCESS;
+}

Possible output:

+
∀∀

References

See also

+ + +
writes a character to stdout
(function)
+
(C95)
writes a wide character to a file stream
(function)
C++ documentation for putwchar
+

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

+
-- cgit v1.2.3