Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

130 lines
5.7KB

  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>wcsrtombs (The Red Hat newlib C Library)</title>
  7. <meta name="description" content="wcsrtombs (The Red Hat newlib C Library)">
  8. <meta name="keywords" content="wcsrtombs (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="Stdlib.html#Stdlib" rel="up" title="Stdlib">
  16. <link href="wcstod.html#wcstod" rel="next" title="wcstod">
  17. <link href="strtoull.html#strtoull" rel="prev" title="strtoull">
  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="wcsrtombs"></a>
  48. <div class="header">
  49. <p>
  50. Next: <a href="wcstod.html#wcstod" accesskey="n" rel="next">wcstod</a>, Previous: <a href="strtoull.html#strtoull" accesskey="p" rel="prev">strtoull</a>, Up: <a href="Stdlib.html#Stdlib" accesskey="u" rel="up">Stdlib</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="wcsrtombs_002c-wcsnrtombs_002d_002d_002dconvert-a-wide_002dcharacter-string-to-a-character-string"></a>
  54. <h3 class="section">2.42 <code>wcsrtombs</code>, <code>wcsnrtombs</code>&mdash;convert a wide-character string to a character string</h3>
  55. <a name="index-wcsrtombs"></a>
  56. <a name="index-_005fwcsrtombs_005fr"></a>
  57. <a name="index-wcsnrtombs"></a>
  58. <a name="index-_005fwcsnrtombs_005fr"></a>
  59. <p><strong>Synopsis</strong>
  60. </p><div class="example">
  61. <pre class="example">#include &lt;wchar.h&gt;
  62. size_t wcsrtombs(char *__restrict <var>dst</var>,
  63. const wchar_t **__restrict <var>src</var>, size_t <var>len</var>,
  64. mbstate_t *__restrict <var>ps</var>);
  65. #include &lt;wchar.h&gt;
  66. size_t _wcsrtombs_r(struct _reent *<var>ptr</var>, char *<var>dst</var>,
  67. const wchar_t **<var>src</var>, size_t <var>len</var>,
  68. mbstate_t *<var>ps</var>);
  69. #include &lt;wchar.h&gt;
  70. size_t wcsnrtombs(char *__restrict <var>dst</var>,
  71. const wchar_t **__restrict <var>src</var>,
  72. size_t <var>nwc</var>, size_t <var>len</var>,
  73. mbstate_t *__restrict <var>ps</var>);
  74. #include &lt;wchar.h&gt;
  75. size_t _wcsnrtombs_r(struct _reent *<var>ptr</var>, char *<var>dst</var>,
  76. const wchar_t **<var>src</var>, size_t <var>nwc</var>,
  77. size_t <var>len</var>, mbstate_t *<var>ps</var>);
  78. </pre></div>
  79. <p><strong>Description</strong><br>
  80. The <code>wcsrtombs</code> function converts a string of wide characters indirectly
  81. pointed to by <var>src</var> to a corresponding multibyte character string stored in
  82. the array pointed to by <var>dst</var>. No more than <var>len</var> bytes are written to
  83. <var>dst</var>.
  84. </p>
  85. <p>If <var>dst</var> is NULL, no characters are stored.
  86. </p>
  87. <p>If <var>dst</var> is not NULL, the pointer pointed to by <var>src</var> is updated to point
  88. to the character after the one that conversion stopped at. If conversion
  89. stops because a null character is encountered, *<var>src</var> is set to NULL.
  90. </p>
  91. <p>The mbstate_t argument, <var>ps</var>, is used to keep track of the shift state. If
  92. it is NULL, <code>wcsrtombs</code> uses an internal, static mbstate_t object, which
  93. is initialized to the initial conversion state at program startup.
  94. </p>
  95. <p>The <code>wcsnrtombs</code> function behaves identically to <code>wcsrtombs</code>, except that
  96. conversion stops after reading at most <var>nwc</var> characters from the buffer
  97. pointed to by <var>src</var>.
  98. </p>
  99. <br>
  100. <p><strong>Returns</strong><br>
  101. The <code>wcsrtombs</code> and <code>wcsnrtombs</code> functions return the number of bytes
  102. stored in the array pointed to by <var>dst</var> (not including any terminating
  103. null), if successful, otherwise it returns (size_t)-1.
  104. </p>
  105. <br>
  106. <p><strong>Portability</strong><br>
  107. <code>wcsrtombs</code> is defined by C99 standard.
  108. <code>wcsnrtombs</code> is defined by the POSIX.1-2008 standard.
  109. </p>
  110. <br>
  111. <hr>
  112. <div class="header">
  113. <p>
  114. Next: <a href="wcstod.html#wcstod" accesskey="n" rel="next">wcstod</a>, Previous: <a href="strtoull.html#strtoull" accesskey="p" rel="prev">strtoull</a>, Up: <a href="Stdlib.html#Stdlib" accesskey="u" rel="up">Stdlib</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>
  115. </div>
  116. </body>
  117. </html>