summaryrefslogtreecommitdiff
path: root/devdocs/c/io%2Fputwchar.html
blob: 9c73d395b52280c6fb3ded46b96403ba110ff7f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
    <h1 id="firstHeading" class="firstHeading">putwchar</h1>            <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code>&lt;wchar.h&gt;</code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl"> <td> <pre data-language="c">wint_t putwchar( wchar_t ch );</pre>
</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c95">(since C95)</span> </td> </tr>  </table> <p>Writes a wide character <code>ch</code> to <code>stdout</code>.</p>
<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> ch </td> <td> - </td> <td> wide character to be written </td>
</tr>
</table> <h3 id="Return_value"> Return value</h3> <p><code>ch</code> on success, <code>WEOF</code> on failure.</p>
<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include &lt;locale.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;wchar.h&gt;
 
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;
}</pre></div> <p>Possible output:</p>
<div class="text source-text"><pre data-language="c">∀∀</pre></div> </div> <h3 id="References"> References</h3>  <ul>
<li> C23 standard (ISO/IEC 9899:2023): </li>
<ul><li> 7.31.3.9 The putwchar function (p: TBD) </li></ul>
<li> C17 standard (ISO/IEC 9899:2018): </li>
<ul><li> 7.29.3.9 The putwchar function (p: 310) </li></ul>
<li> C11 standard (ISO/IEC 9899:2011): </li>
<ul><li> 7.29.3.9 The putwchar function (p: 425) </li></ul>
<li> C99 standard (ISO/IEC 9899:1999): </li>
<ul><li> 7.24.3.9 The putwchar function (p: 370) </li></ul>
</ul>               <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="putchar" title="c/io/putchar"> <span class="t-lines"><span>putchar</span></span></a></div> </td> <td> writes a character to <code>stdout</code> <br> <span class="t-mark">(function)</span>  </td>
</tr> <tr class="t-dsc"> <td> <div><a href="fputwc" title="c/io/fputwc"> <span class="t-lines"><span>fputwc</span><span>putwc</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> writes a wide character to a file stream <br> <span class="t-mark">(function)</span>  </td>
</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/io/c/putwchar" title="cpp/io/c/putwchar">C++ documentation</a></span> for <code>putwchar</code> </td>
</tr> </table>           <div class="_attribution">
  <p class="_attribution-p">
    &copy; cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br>
    <a href="https://en.cppreference.com/w/c/io/putwchar" class="_attribution-link">https://en.cppreference.com/w/c/io/putwchar</a>
  </p>
</div>