Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

3 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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>fgetws (The Red Hat newlib C Library)</title>
  7. <meta name="description" content="fgetws (The Red Hat newlib C Library)">
  8. <meta name="keywords" content="fgetws (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="fileno.html#fileno" rel="next" title="fileno">
  17. <link href="fgetwc.html#fgetwc" rel="prev" title="fgetwc">
  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="fgetws"></a>
  48. <div class="header">
  49. <p>
  50. Next: <a href="fileno.html#fileno" accesskey="n" rel="next">fileno</a>, Previous: <a href="fgetwc.html#fgetwc" accesskey="p" rel="prev">fgetwc</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="fgetws_002c-fgetws_005funlocked_002d_002d_002dget-wide-character-string-from-a-file-or-stream"></a>
  54. <h3 class="section">4.14 <code>fgetws</code>, <code>fgetws_unlocked</code>&mdash;get wide character string from a file or stream</h3>
  55. <a name="index-fgetws"></a>
  56. <a name="index-fgetws_005funlocked"></a>
  57. <a name="index-_005ffgetws_005fr"></a>
  58. <a name="index-_005ffgetws_005funlocked_005fr"></a>
  59. <p><strong>Synopsis</strong>
  60. </p><div class="example">
  61. <pre class="example">#include &lt;wchar.h&gt;
  62. wchar_t *fgetws(wchar_t *__restrict <var>ws</var>, int <var>n</var>,
  63. FILE *__restrict <var>fp</var>);
  64. #define _GNU_SOURCE
  65. #include &lt;wchar.h&gt;
  66. wchar_t *fgetws_unlocked(wchar_t *__restrict <var>ws</var>, int <var>n</var>,
  67. FILE *__restrict <var>fp</var>);
  68. #include &lt;wchar.h&gt;
  69. wchar_t *_fgetws_r(struct _reent *<var>ptr</var>, wchar_t *<var>ws</var>,
  70. int <var>n</var>, FILE *<var>fp</var>);
  71. #include &lt;wchar.h&gt;
  72. wchar_t *_fgetws_unlocked_r(struct _reent *<var>ptr</var>, wchar_t *<var>ws</var>,
  73. int <var>n</var>, FILE *<var>fp</var>);
  74. </pre></div>
  75. <p><strong>Description</strong><br>
  76. Reads at most <var>n-1</var> wide characters from <var>fp</var> until a newline
  77. is found. The wide characters including to the newline are stored
  78. in <var>ws</var>. The buffer is terminated with a 0.
  79. </p>
  80. <p><code>fgetws_unlocked</code> is a non-thread-safe version of <code>fgetws</code>.
  81. <code>fgetws_unlocked</code> may only safely be used within a scope
  82. protected by flockfile() (or ftrylockfile()) and funlockfile(). This
  83. function may safely be used in a multi-threaded program if and only
  84. if they are called while the invoking thread owns the (FILE *)
  85. object, as is the case after a successful call to the flockfile() or
  86. ftrylockfile() functions. If threads are disabled, then
  87. <code>fgetws_unlocked</code> is equivalent to <code>fgetws</code>.
  88. </p>
  89. <p>The <code>_fgetws_r</code> and <code>_fgetws_unlocked_r</code> functions are simply reentrant
  90. version of the above and are passed an additional reentrancy structure
  91. pointer: <var>ptr</var>.
  92. </p>
  93. <br>
  94. <p><strong>Returns</strong><br>
  95. <code>fgetws</code> returns the buffer passed to it, with the data
  96. filled in. If end of file occurs with some data already
  97. accumulated, the data is returned with no other indication. If
  98. no data are read, NULL is returned instead.
  99. </p>
  100. <br>
  101. <p><strong>Portability</strong><br>
  102. <code>fgetws</code> is required by C99 and POSIX.1-2001.
  103. </p>
  104. <p><code>fgetws_unlocked</code> is a GNU extension.
  105. </p>
  106. <br>
  107. </body>
  108. </html>