Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

il y a 3 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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>fgetwc (The Red Hat newlib C Library)</title>
  7. <meta name="description" content="fgetwc (The Red Hat newlib C Library)">
  8. <meta name="keywords" content="fgetwc (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="fgetws.html#fgetws" rel="next" title="fgetws">
  17. <link href="fgets.html#fgets" rel="prev" title="fgets">
  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="fgetwc"></a>
  48. <div class="header">
  49. <p>
  50. Next: <a href="fgetws.html#fgetws" accesskey="n" rel="next">fgetws</a>, Previous: <a href="fgets.html#fgets" accesskey="p" rel="prev">fgets</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="fgetwc_002c-getwc_002c-fgetwc_005funlocked_002c-getwc_005funlocked_002d_002d_002dget-a-wide-character-from-a-file-or-stream"></a>
  54. <h3 class="section">4.13 <code>fgetwc</code>, <code>getwc</code>, <code>fgetwc_unlocked</code>, <code>getwc_unlocked</code>&mdash;get a wide character from a file or stream</h3>
  55. <a name="index-fgetwc"></a>
  56. <a name="index-fgetwc_005funlocked"></a>
  57. <a name="index-_005ffgetwc_005fr"></a>
  58. <a name="index-_005ffgetwc_005funlocked_005fr"></a>
  59. <a name="index-getwc"></a>
  60. <a name="index-getwc_005funlocked"></a>
  61. <a name="index-_005fgetwc_005fr"></a>
  62. <a name="index-_005fgetwc_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 fgetwc(FILE *<var>fp</var>);
  68. #define _GNU_SOURCE
  69. #include &lt;stdio.h&gt;
  70. #include &lt;wchar.h&gt;
  71. wint_t fgetwc_unlocked(FILE *<var>fp</var>);
  72. #include &lt;stdio.h&gt;
  73. #include &lt;wchar.h&gt;
  74. wint_t _fgetwc_r(struct _reent *<var>ptr</var>, FILE *<var>fp</var>);
  75. #include &lt;stdio.h&gt;
  76. #include &lt;wchar.h&gt;
  77. wint_t _fgetwc_unlocked_r(struct _reent *<var>ptr</var>, FILE *<var>fp</var>);
  78. #include &lt;stdio.h&gt;
  79. #include &lt;wchar.h&gt;
  80. wint_t getwc(FILE *<var>fp</var>);
  81. #define _GNU_SOURCE
  82. #include &lt;stdio.h&gt;
  83. #include &lt;wchar.h&gt;
  84. wint_t getwc_unlocked(FILE *<var>fp</var>);
  85. #include &lt;stdio.h&gt;
  86. #include &lt;wchar.h&gt;
  87. wint_t _getwc_r(struct _reent *<var>ptr</var>, FILE *<var>fp</var>);
  88. #include &lt;stdio.h&gt;
  89. #include &lt;wchar.h&gt;
  90. wint_t _getwc_unlocked_r(struct _reent *<var>ptr</var>, FILE *<var>fp</var>);
  91. </pre></div>
  92. <p><strong>Description</strong><br>
  93. Use <code>fgetwc</code> to get the next wide character from the file or stream
  94. identified by <var>fp</var>. As a side effect, <code>fgetwc</code> advances the file&rsquo;s
  95. current position indicator.
  96. </p>
  97. <p><code>fgetwc_unlocked</code> is a non-thread-safe version of <code>fgetwc</code>.
  98. <code>fgetwc_unlocked</code> may only safely be used within a scope
  99. protected by flockfile() (or ftrylockfile()) and funlockfile(). This
  100. function may safely be used in a multi-threaded program if and only
  101. if they are called while the invoking thread owns the (FILE *)
  102. object, as is the case after a successful call to the flockfile() or
  103. ftrylockfile() functions. If threads are disabled, then
  104. <code>fgetwc_unlocked</code> is equivalent to <code>fgetwc</code>.
  105. </p>
  106. <p>The <code>getwc</code> and <code>getwc_unlocked</code> functions or macros functions identically
  107. to <code>fgetwc</code> and <code>fgetwc_unlocked</code>. It may be implemented as a macro, and
  108. may evaluate its argument more than once. There is no reason ever to use it.
  109. </p>
  110. <p><code>_fgetwc_r</code>, <code>_getwc_r</code>, <code>_fgetwc_unlocked_r</code>, and <code>_getwc_unlocked_r</code>
  111. are simply reentrant versions of the above functions that are passed the
  112. additional reentrant structure pointer argument: <var>ptr</var>.
  113. </p>
  114. <br>
  115. <p><strong>Returns</strong><br>
  116. The next wide character cast to <code>wint_t</code>, unless there is no more data,
  117. or the host system reports a read error; in either of these situations,
  118. <code>fgetwc</code> and <code>getwc</code> return <code>WEOF</code>.
  119. </p>
  120. <p>You can distinguish the two situations that cause an <code>EOF</code> result by
  121. using the <code>ferror</code> and <code>feof</code> functions.
  122. </p>
  123. <br>
  124. <p><strong>Portability</strong><br>
  125. <code>fgetwc</code> and <code>getwc</code> are required by C99 and POSIX.1-2001.
  126. </p>
  127. <p><code>fgetwc_unlocked</code> and <code>getwc_unlocked</code> are GNU extensions.
  128. </p>
  129. <br>
  130. <hr>
  131. <div class="header">
  132. <p>
  133. Next: <a href="fgetws.html#fgetws" accesskey="n" rel="next">fgetws</a>, Previous: <a href="fgets.html#fgets" accesskey="p" rel="prev">fgets</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>
  134. </div>
  135. </body>
  136. </html>