summaryrefslogtreecommitdiff
path: root/devdocs/c/io%2Ffputws.html
blob: 04e2ddf9905641dac48d61e5f1be85a90cf5252d (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
    <h1 id="firstHeading" class="firstHeading">fputws</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 t-since-c95 t-until-c99"> <td> <pre data-language="c">int fputws( const wchar_t *str, FILE *stream );</pre>
</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c95">(since C95)</span> <br><span class="t-mark-rev t-until-c99">(until C99)</span> </td> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">int fputws( const wchar_t * restrict str, FILE * restrict stream );</pre>
</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr>   </table> <p>Writes every character from the null-terminated wide string <code>str</code> to the output stream <code>stream</code>, as if by repeatedly executing <code><a href="fputwc" title="c/io/fputwc">fputwc</a></code>.</p>
<p>The terminating null wide character from <code>str</code> is not written.</p>
<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> str </td> <td> - </td> <td> null-terminated wide string to be written </td>
</tr> <tr class="t-par"> <td> stream </td> <td> - </td> <td> output stream </td>
</tr>
</table> <h3 id="Return_value"> Return value</h3> <p>On success, returns a non-negative value</p>
<p>On failure, returns <code><a href="../io" title="c/io">EOF</a></code> and sets the <i>error</i> indicator (see <code><a href="ferror" title="c/io/ferror">ferror</a></code>) on <code>stream</code>.</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;wchar.h&gt;
 
int main(void)
{
    setlocale(LC_ALL, "en_US.utf8");
    int rc = fputws(L"御休みなさい", stdout);
 
    if (rc == EOF)
       perror("fputws()"); // POSIX requires that errno is set
}</pre></div> <p>Output:</p>
<div class="text source-text"><pre data-language="c">御休みなさい</pre></div> </div> <h3 id="References"> References</h3>  <ul>
<li> C11 standard (ISO/IEC 9899:2011): </li>
<ul><li> 7.29.3.4 The fputws function (p: 423) </li></ul>
<li> C99 standard (ISO/IEC 9899:1999): </li>
<ul><li> 7.24.3.4 The fputws function (p: 368) </li></ul>
</ul>      <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="fputs" title="c/io/fputs"> <span class="t-lines"><span>fputs</span></span></a></div> </td> <td> writes a character string to a file stream <br> <span class="t-mark">(function)</span>  </td>
</tr> <tr class="t-dsc"> <td> <div><a href="fwprintf" title="c/io/fwprintf"> <span class="t-lines"><span>wprintf</span><span>fwprintf</span><span>swprintf</span><span>wprintf_s</span><span>fwprintf_s</span><span>swprintf_s</span><span>snwprintf_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span><span><span class="t-mark-rev t-since-c95">(C95)</span></span><span><span class="t-mark-rev t-since-c95">(C95)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> prints formatted wide character output to <code><a href="std_streams" title="c/io/std streams">stdout</a></code>, a file stream or a buffer <br> <span class="t-mark">(function)</span>  </td>
</tr> <tr class="t-dsc"> <td> <div><strong class="selflink"> <span class="t-lines"><span>fputws</span></span></strong></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 string to a file stream <br> <span class="t-mark">(function)</span>  </td>
</tr> <tr class="t-dsc"> <td> <div><a href="fgetws" title="c/io/fgetws"> <span class="t-lines"><span>fgetws</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> gets a wide string from 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/fputws" title="cpp/io/c/fputws">C++ documentation</a></span> for <code>fputws</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/fputws" class="_attribution-link">https://en.cppreference.com/w/c/io/fputws</a>
  </p>
</div>