You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 line
6.6KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>fputwc (The Red Hat newlib C Library)</title>
  7. <meta name="description" content="fputwc (The Red Hat newlib C Library)">
  8. <meta name="keywords" content="fputwc (The Red Hat newlib C Library)">
  9. <meta name="resource-type" content="document">
  10. <meta name="distribution" content="global">
  11. <meta name="Generator" content="makeinfo">
  12. <link href="index.html#Top" rel="start" title="Top">
  13. <link href="Document-Index.html#Document-Index" rel="index" title="Document Index">
  14. <link href="Document-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
  15. <link href="Stdio.html#Stdio" rel="up" title="Stdio">
  16. <link href="fputws.html#fputws" rel="next" title="fputws">
  17. <link href="fputs.html#fputs" rel="prev" title="fputs">
  18. <style type="text/css">
  19. <!--
  20. a.summary-letter {text-decoration: none}
  21. blockquote.indentedblock {margin-right: 0em}
  22. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  23. blockquote.smallquotation {font-size: smaller}
  24. div.display {margin-left: 3.2em}
  25. div.example {margin-left: 3.2em}
  26. div.lisp {margin-left: 3.2em}
  27. div.smalldisplay {margin-left: 3.2em}
  28. div.smallexample {margin-left: 3.2em}
  29. div.smalllisp {margin-left: 3.2em}
  30. kbd {font-style: oblique}
  31. pre.display {font-family: inherit}
  32. pre.format {font-family: inherit}
  33. pre.menu-comment {font-family: serif}
  34. pre.menu-preformatted {font-family: serif}
  35. pre.smalldisplay {font-family: inherit; font-size: smaller}
  36. pre.smallexample {font-size: smaller}
  37. pre.smallformat {font-family: inherit; font-size: smaller}
  38. pre.smalllisp {font-size: smaller}
  39. span.nolinebreak {white-space: nowrap}
  40. span.roman {font-family: initial; font-weight: normal}
  41. span.sansserif {font-family: sans-serif; font-weight: normal}
  42. ul.no-bullet {list-style: none}
  43. -->
  44. </style>
  45. </head>
  46. <body lang="en">
  47. <a name="fputwc"></a>
  48. <div class="header">
  49. <p>
  50. Next: <a href="fputws.html#fputws" accesskey="n" rel="next">fputws</a>, Previous: <a href="fputs.html#fputs" accesskey="p" rel="prev">fputs</a>, Up: <a href="Stdio.html#Stdio" accesskey="u" rel="up">Stdio</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  51. </div>
  52. <hr>
  53. <a name="fputwc_002c-putwc_002c-fputwc_005funlocked_002c-putwc_005funlocked_002d_002d_002dwrite-a-wide-character-on-a-stream-or-file"></a>
  54. <h3 class="section">4.22 <code>fputwc</code>, <code>putwc</code>, <code>fputwc_unlocked</code>, <code>putwc_unlocked</code>&mdash;write a wide character on a stream or file</h3>
  55. <a name="index-fputwc"></a>
  56. <a name="index-fputwc_005funlocked"></a>
  57. <a name="index-_005ffputwc_005fr"></a>
  58. <a name="index-_005ffputwc_005funlocked_005fr"></a>
  59. <a name="index-putwc"></a>
  60. <a name="index-putwc_005funlocked"></a>
  61. <a name="index-_005fputwc_005fr"></a>
  62. <a name="index-_005fputwc_005funlocked_005fr"></a>
  63. <p><strong>Synopsis</strong>
  64. </p><div class="example">
  65. <pre class="example">#include &lt;stdio.h&gt;
  66. #include &lt;wchar.h&gt;
  67. wint_t fputwc(wchar_t <var>wc</var>, FILE *<var>fp</var>);
  68. #define _GNU_SOURCE
  69. #include &lt;stdio.h&gt;
  70. #include &lt;wchar.h&gt;
  71. wint_t fputwc_unlocked(wchar_t <var>wc</var>, FILE *<var>fp</var>);
  72. #include &lt;stdio.h&gt;
  73. #include &lt;wchar.h&gt;
  74. wint_t _fputwc_r(struct _reent *<var>ptr</var>, wchar_t <var>wc</var>, FILE *<var>fp</var>);
  75. #include &lt;stdio.h&gt;
  76. #include &lt;wchar.h&gt;
  77. wint_t _fputwc_unlocked_r(struct _reent *<var>ptr</var>, wchar_t <var>wc</var>, FILE *<var>fp</var>);
  78. #include &lt;stdio.h&gt;
  79. #include &lt;wchar.h&gt;
  80. wint_t putwc(wchar_t <var>wc</var>, FILE *<var>fp</var>);
  81. #define _GNU_SOURCE
  82. #include &lt;stdio.h&gt;
  83. #include &lt;wchar.h&gt;
  84. wint_t putwc_unlocked(wchar_t <var>wc</var>, FILE *<var>fp</var>);
  85. #include &lt;stdio.h&gt;
  86. #include &lt;wchar.h&gt;
  87. wint_t _putwc_r(struct _reent *<var>ptr</var>, wchar_t <var>wc</var>, FILE *<var>fp</var>);
  88. #include &lt;stdio.h&gt;
  89. #include &lt;wchar.h&gt;
  90. wint_t _putwc_unlocked_r(struct _reent *<var>ptr</var>, wchar_t <var>wc</var>, FILE *<var>fp</var>);
  91. </pre></div>
  92. <p><strong>Description</strong><br>
  93. <code>fputwc</code> writes the wide character argument <var>wc</var> to the file or
  94. stream identified by <var>fp</var>.
  95. </p>
  96. <p>If the file was opened with append mode (or if the stream cannot
  97. support positioning), then the new wide character goes at the end of the
  98. file or stream. Otherwise, the new wide character is written at the
  99. current value of the position indicator, and the position indicator
  100. oadvances by one.
  101. </p>
  102. <p><code>fputwc_unlocked</code> is a non-thread-safe version of <code>fputwc</code>.
  103. <code>fputwc_unlocked</code> may only safely be used within a scope
  104. protected by flockfile() (or ftrylockfile()) and funlockfile(). This
  105. function may safely be used in a multi-threaded program if and only
  106. if they are called while the invoking thread owns the (FILE *)
  107. object, as is the case after a successful call to the flockfile() or
  108. ftrylockfile() functions. If threads are disabled, then
  109. <code>fputwc_unlocked</code> is equivalent to <code>fputwc</code>.
  110. </p>
  111. <p>The <code>putwc</code> and <code>putwc_unlocked</code> functions or macros function identically
  112. to <code>fputwc</code> and <code>fputwc_unlocked</code>. They may be implemented as a macro, and
  113. may evaluate its argument more than once. There is no reason ever to use them.
  114. </p>
  115. <p>The <code>_fputwc_r</code>, <code>_putwc_r</code>, <code>_fputwc_unlocked_r</code>, and
  116. <code>_putwc_unlocked_r</code> functions are simply reentrant versions of the above
  117. that take an additional reentrant structure argument: <var>ptr</var>.
  118. </p>
  119. <br>
  120. <p><strong>Returns</strong><br>
  121. If successful, <code>fputwc</code> and <code>putwc</code> return their argument <var>wc</var>.
  122. If an error intervenes, the result is <code>EOF</code>. You can use
  123. &lsquo;<code>ferror(<var>fp</var>)</code>&rsquo; to query for errors.
  124. </p>
  125. <br>
  126. <p><strong>Portability</strong><br>
  127. <code>fputwc</code> and <code>putwc</code> are required by C99 and POSIX.1-2001.
  128. </p>
  129. <p><code>fputwc_unlocked</code> and <code>putwc_unlocked</code> are GNU extensions.
  130. </p>
  131. <br>
  132. <hr>
  133. <div class="header">
  134. <p>
  135. Next: <a href="fputws.html#fputws" accesskey="n" rel="next">fputws</a>, Previous: <a href="fputs.html#fputs" accesskey="p" rel="prev">fputs</a>, Up: <a href="Stdio.html#Stdio" accesskey="u" rel="up">Stdio</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  136. </div>
  137. </body>
  138. </html>