logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

wcrtomb.3p (4119B)


  1. '\" et
  2. .TH WCRTOMB "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. wcrtomb
  12. \(em convert a wide-character code to a character (restartable)
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <wchar.h>
  17. .P
  18. size_t wcrtomb(char *restrict \fIs\fP, wchar_t \fIwc\fP, mbstate_t *restrict \fIps\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The functionality described on this reference page is aligned with the
  22. ISO\ C standard. Any conflict between the requirements described here and the
  23. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  24. .P
  25. If
  26. .IR s
  27. is a null pointer, the
  28. \fIwcrtomb\fR()
  29. function shall be equivalent to the call:
  30. .sp
  31. .RS 4
  32. .nf
  33. wcrtomb(\fIbuf\fP, L\(aq\e0\(aq, \fIps\fP)
  34. .fi
  35. .P
  36. .RE
  37. .P
  38. where
  39. .IR buf
  40. is an internal buffer.
  41. .P
  42. If
  43. .IR s
  44. is not a null pointer, the
  45. \fIwcrtomb\fR()
  46. function shall determine the number of bytes needed to represent the
  47. character that corresponds to the wide character given by
  48. .IR wc
  49. (including any shift sequences), and store the resulting bytes in the
  50. array whose first element is pointed to by
  51. .IR s .
  52. At most
  53. {MB_CUR_MAX}
  54. bytes are stored. If
  55. .IR wc
  56. is a null wide character, a null byte shall be stored, preceded by any
  57. shift sequence needed to restore the initial shift state. The resulting
  58. state described shall be the initial conversion state.
  59. .P
  60. If
  61. .IR ps
  62. is a null pointer, the
  63. \fIwcrtomb\fR()
  64. function shall use its own internal
  65. .BR mbstate_t
  66. object, which is initialized at program start-up to the initial
  67. conversion state. Otherwise, the
  68. .BR mbstate_t
  69. object pointed to by
  70. .IR ps
  71. shall be used to completely describe the current conversion state of
  72. the associated character sequence. The implementation shall behave as
  73. if no function defined in this volume of POSIX.1\(hy2017 calls
  74. \fIwcrtomb\fR().
  75. .P
  76. The
  77. \fIwcrtomb\fR()
  78. function need not be thread-safe if called with a NULL
  79. .IR ps
  80. argument.
  81. .P
  82. The behavior of this function shall be affected by the
  83. .IR LC_CTYPE
  84. category of the current locale.
  85. .P
  86. The
  87. \fIwcrtomb\fR()
  88. function shall not change the setting of
  89. .IR errno
  90. if successful.
  91. .SH "RETURN VALUE"
  92. The
  93. \fIwcrtomb\fR()
  94. function shall return the number of bytes stored in the array object
  95. (including any shift sequences). When
  96. .IR wc
  97. is not a valid wide character, an encoding error shall occur. In this
  98. case, the function shall store the value of the macro
  99. .BR [EILSEQ]
  100. in
  101. .IR errno
  102. and shall return (\fBsize_t\fP)\-1; the conversion state shall be
  103. undefined.
  104. .SH ERRORS
  105. The
  106. \fIwcrtomb\fR()
  107. function shall fail if:
  108. .TP
  109. .BR EILSEQ
  110. An invalid wide-character code is detected.
  111. .P
  112. The
  113. \fIwcrtomb\fR()
  114. function may fail if:
  115. .TP
  116. .BR EINVAL
  117. .IR ps
  118. points to an object that contains an invalid conversion state.
  119. .LP
  120. .IR "The following sections are informative."
  121. .SH EXAMPLES
  122. None.
  123. .SH "APPLICATION USAGE"
  124. None.
  125. .SH RATIONALE
  126. None.
  127. .SH "FUTURE DIRECTIONS"
  128. None.
  129. .SH "SEE ALSO"
  130. .IR "\fImbsinit\fR\^(\|)",
  131. .IR "\fIwcsrtombs\fR\^(\|)"
  132. .P
  133. The Base Definitions volume of POSIX.1\(hy2017,
  134. .IR "\fB<wchar.h>\fP"
  135. .\"
  136. .SH COPYRIGHT
  137. Portions of this text are reprinted and reproduced in electronic form
  138. from IEEE Std 1003.1-2017, Standard for Information Technology
  139. -- Portable Operating System Interface (POSIX), The Open Group Base
  140. Specifications Issue 7, 2018 Edition,
  141. Copyright (C) 2018 by the Institute of
  142. Electrical and Electronics Engineers, Inc and The Open Group.
  143. In the event of any discrepancy between this version and the original IEEE and
  144. The Open Group Standard, the original IEEE and The Open Group Standard
  145. is the referee document. The original Standard can be obtained online at
  146. http://www.opengroup.org/unix/online.html .
  147. .PP
  148. Any typographical or formatting errors that appear
  149. in this page are most likely
  150. to have been introduced during the conversion of the source files to
  151. man page format. To report such errors, see
  152. https://www.kernel.org/doc/man-pages/reporting_bugs.html .