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

mbtowc.3p (4384B)


  1. '\" et
  2. .TH MBTOWC "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. mbtowc
  12. \(em convert a character to a wide-character code
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <stdlib.h>
  17. .P
  18. int mbtowc(wchar_t *restrict \fIpwc\fP, const char *restrict \fIs\fP, size_t \fIn\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 not a null pointer,
  28. \fImbtowc\fR()
  29. shall determine the number of bytes that constitute the character
  30. pointed to by
  31. .IR s .
  32. It shall then determine the wide-character code for the value of type
  33. .BR wchar_t
  34. that corresponds to that character. (The value of the wide-character
  35. code corresponding to the null byte is 0.) If the character is valid
  36. and
  37. .IR pwc
  38. is not a null pointer,
  39. \fImbtowc\fR()
  40. shall store the wide-character code in the object pointed to by
  41. .IR pwc .
  42. .P
  43. The behavior of this function is affected by the
  44. .IR LC_CTYPE
  45. category of the current locale. For a state-dependent encoding, this
  46. function is placed into its initial state by a call for which its
  47. character pointer argument,
  48. .IR s ,
  49. is a null pointer. Subsequent calls with
  50. .IR s
  51. as other than a null pointer shall cause the internal state of the
  52. function to be altered as necessary. A call with
  53. .IR s
  54. as a null pointer shall cause this function to return a non-zero value
  55. if encodings have state dependency, and 0 otherwise. If the
  56. implementation employs special bytes to change the shift state, these
  57. bytes shall not produce separate wide-character codes, but shall be
  58. grouped with an adjacent character. Changing the
  59. .IR LC_CTYPE
  60. category causes the shift state of this function to be unspecified. At
  61. most
  62. .IR n
  63. bytes of the array pointed to by
  64. .IR s
  65. shall be examined.
  66. .P
  67. The implementation shall behave as if no function defined in this volume of POSIX.1\(hy2017 calls
  68. \fImbtowc\fR().
  69. .P
  70. The
  71. \fImbtowc\fR()
  72. function need not be thread-safe.
  73. .SH "RETURN VALUE"
  74. If
  75. .IR s
  76. is a null pointer,
  77. \fImbtowc\fR()
  78. shall return a non-zero or 0 value, if character encodings, respectively,
  79. do or do not have state-dependent encodings. If
  80. .IR s
  81. is not a null pointer,
  82. \fImbtowc\fR()
  83. shall either return 0 (if
  84. .IR s
  85. points to the null byte), or return the number of bytes that constitute
  86. the converted character (if the next
  87. .IR n
  88. or fewer bytes form a valid character), or return \-1
  89. and shall set
  90. .IR errno
  91. to indicate the error
  92. (if they do not form a valid character).
  93. .P
  94. In no case shall the value returned be greater than
  95. .IR n
  96. or the value of the
  97. {MB_CUR_MAX}
  98. macro.
  99. .SH ERRORS
  100. The
  101. \fImbtowc\fR()
  102. function shall fail if:
  103. .TP
  104. .BR EILSEQ
  105. An invalid character sequence is detected. In the POSIX locale an
  106. .BR [EILSEQ]
  107. error cannot occur since all byte values are valid characters.
  108. .LP
  109. .IR "The following sections are informative."
  110. .SH EXAMPLES
  111. None.
  112. .SH "APPLICATION USAGE"
  113. None.
  114. .SH RATIONALE
  115. None.
  116. .SH "FUTURE DIRECTIONS"
  117. None.
  118. .SH "SEE ALSO"
  119. .IR "\fImblen\fR\^(\|)",
  120. .IR "\fImbstowcs\fR\^(\|)",
  121. .IR "\fIwctomb\fR\^(\|)",
  122. .IR "\fIwcstombs\fR\^(\|)"
  123. .P
  124. The Base Definitions volume of POSIX.1\(hy2017,
  125. .IR "\fB<stdlib.h>\fP"
  126. .\"
  127. .SH COPYRIGHT
  128. Portions of this text are reprinted and reproduced in electronic form
  129. from IEEE Std 1003.1-2017, Standard for Information Technology
  130. -- Portable Operating System Interface (POSIX), The Open Group Base
  131. Specifications Issue 7, 2018 Edition,
  132. Copyright (C) 2018 by the Institute of
  133. Electrical and Electronics Engineers, Inc and The Open Group.
  134. In the event of any discrepancy between this version and the original IEEE and
  135. The Open Group Standard, the original IEEE and The Open Group Standard
  136. is the referee document. The original Standard can be obtained online at
  137. http://www.opengroup.org/unix/online.html .
  138. .PP
  139. Any typographical or formatting errors that appear
  140. in this page are most likely
  141. to have been introduced during the conversion of the source files to
  142. man page format. To report such errors, see
  143. https://www.kernel.org/doc/man-pages/reporting_bugs.html .