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

wcstoul.3p (6674B)


  1. '\" et
  2. .TH WCSTOUL "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. wcstoul,
  12. wcstoull
  13. \(em convert a wide-character string to an unsigned long
  14. .SH SYNOPSIS
  15. .LP
  16. .nf
  17. #include <wchar.h>
  18. .P
  19. unsigned long wcstoul(const wchar_t *restrict \fInptr\fP,
  20. wchar_t **restrict \fIendptr\fP, int \fIbase\fP);
  21. unsigned long long wcstoull(const wchar_t *restrict \fInptr\fP,
  22. wchar_t **restrict \fIendptr\fP, int \fIbase\fP);
  23. .fi
  24. .SH DESCRIPTION
  25. The functionality described on this reference page is aligned with the
  26. ISO\ C standard. Any conflict between the requirements described here and the
  27. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  28. .P
  29. The
  30. \fIwcstoul\fR()
  31. and
  32. \fIwcstoull\fR()
  33. functions shall convert the initial portion of the wide-character
  34. string pointed to by
  35. .IR nptr
  36. to
  37. .BR "unsigned long"
  38. and
  39. .BR "unsigned long long"
  40. representation, respectively. First, they shall decompose the input
  41. wide-character string into three parts:
  42. .IP " 1." 4
  43. An initial, possibly empty, sequence of white-space wide-character
  44. codes (as specified by
  45. \fIiswspace\fR())
  46. .IP " 2." 4
  47. A subject sequence interpreted as an integer represented in some radix
  48. determined by the value of
  49. .IR base
  50. .IP " 3." 4
  51. A final wide-character string of one or more unrecognized
  52. wide-character codes, including the terminating null wide-character
  53. code of the input wide-character string
  54. .P
  55. Then they shall attempt to convert the subject sequence to an
  56. unsigned integer, and return the result.
  57. .P
  58. If
  59. .IR base
  60. is 0, the expected form of the subject sequence is that of a decimal
  61. constant, octal constant, or hexadecimal constant, any of which may be
  62. preceded by a
  63. .BR '+'
  64. or
  65. .BR '\-'
  66. sign. A decimal constant begins with a non-zero digit, and consists of
  67. a sequence of decimal digits. An octal constant consists of the prefix
  68. .BR '0'
  69. optionally followed by a sequence of the digits
  70. .BR '0'
  71. to
  72. .BR '7'
  73. only. A hexadecimal constant consists of the prefix 0x or 0X followed
  74. by a sequence of the decimal digits and letters
  75. .BR 'a'
  76. (or
  77. .BR 'A' )
  78. to
  79. .BR 'f'
  80. (or
  81. .BR 'F' )
  82. with values 10 to 15 respectively.
  83. .P
  84. If the value of
  85. .IR base
  86. is between 2 and 36, the expected form of the subject sequence is a
  87. sequence of letters and digits representing an integer with the radix
  88. specified by
  89. .IR base ,
  90. optionally preceded by a
  91. .BR '+'
  92. or
  93. .BR '\-'
  94. sign, but not including an integer suffix. The letters from
  95. .BR 'a'
  96. (or
  97. .BR 'A' )
  98. to
  99. .BR 'z'
  100. (or
  101. .BR 'Z' )
  102. inclusive are ascribed the values 10 to 35; only letters whose ascribed
  103. values are less than that of
  104. .IR base
  105. shall be permitted. If the value of
  106. .IR base
  107. is 16, the wide-character codes 0x or 0X may optionally precede the
  108. sequence of letters and digits, following the sign if present.
  109. .P
  110. The subject sequence is defined as the longest initial subsequence of
  111. the input wide-character string, starting with the first wide-character
  112. code that is not white space and is of the expected form. The subject
  113. sequence contains no wide-character codes if the input wide-character
  114. string is empty or consists entirely of white-space wide-character
  115. codes, or if the first wide-character code that is not white space is
  116. other than a sign or a permissible letter or digit.
  117. .P
  118. If the subject sequence has the expected form and
  119. .IR base
  120. is 0, the sequence of wide-character codes starting with the first
  121. digit shall be interpreted as an integer constant. If the subject
  122. sequence has the expected form and the value of
  123. .IR base
  124. is between 2 and 36, it shall be used as the base for conversion,
  125. ascribing to each letter its value as given above. If the subject
  126. sequence begins with a
  127. <hyphen-minus>,
  128. the value resulting from the
  129. conversion shall be negated. A pointer to the final wide-character
  130. string shall be stored in the object pointed to by
  131. .IR endptr ,
  132. provided that
  133. .IR endptr
  134. is not a null pointer.
  135. .P
  136. In other than the C
  137. or POSIX
  138. locale, additional locale-specific subject sequence forms may be
  139. accepted.
  140. .P
  141. If the subject sequence is empty or does not have the expected form, no
  142. conversion shall be performed; the value of
  143. .IR nptr
  144. shall be stored in the object pointed to by
  145. .IR endptr ,
  146. provided that
  147. .IR endptr
  148. is not a null pointer.
  149. .P
  150. These functions shall not change the setting of
  151. .IR errno
  152. if successful.
  153. .P
  154. Since 0,
  155. {ULONG_MAX},
  156. and
  157. {ULLONG_MAX}
  158. are returned on error and 0 is also a valid return on success, an
  159. application wishing to check for error situations should set
  160. .IR errno
  161. to 0, then call
  162. \fIwcstoul\fR()
  163. or
  164. \fIwcstoull\fR(),
  165. then check
  166. .IR errno .
  167. .SH "RETURN VALUE"
  168. Upon successful completion, the
  169. \fIwcstoul\fR()
  170. and
  171. \fIwcstoull\fR()
  172. functions shall return the converted value, if any. If no conversion
  173. could be performed, 0 shall be returned
  174. and
  175. .IR errno
  176. may be set to indicate the error.
  177. If the correct value is outside the range of representable values,
  178. {ULONG_MAX}
  179. or
  180. {ULLONG_MAX}
  181. respectively shall be returned and
  182. .IR errno
  183. set to
  184. .BR [ERANGE] .
  185. .SH ERRORS
  186. These functions shall fail if:
  187. .TP
  188. .BR EINVAL
  189. The value of
  190. .IR base
  191. is not supported.
  192. .TP
  193. .BR ERANGE
  194. The value to be returned is not representable.
  195. .P
  196. These functions may fail if:
  197. .TP
  198. .BR EINVAL
  199. No conversion could be performed.
  200. .LP
  201. .IR "The following sections are informative."
  202. .SH EXAMPLES
  203. None.
  204. .SH "APPLICATION USAGE"
  205. None.
  206. .SH RATIONALE
  207. None.
  208. .SH "FUTURE DIRECTIONS"
  209. None.
  210. .SH "SEE ALSO"
  211. .IR "\fIfscanf\fR\^(\|)",
  212. .IR "\fIiswalpha\fR\^(\|)",
  213. .IR "\fIwcstod\fR\^(\|)",
  214. .IR "\fIwcstol\fR\^(\|)"
  215. .P
  216. The Base Definitions volume of POSIX.1\(hy2017,
  217. .IR "\fB<wchar.h>\fP"
  218. .\"
  219. .SH COPYRIGHT
  220. Portions of this text are reprinted and reproduced in electronic form
  221. from IEEE Std 1003.1-2017, Standard for Information Technology
  222. -- Portable Operating System Interface (POSIX), The Open Group Base
  223. Specifications Issue 7, 2018 Edition,
  224. Copyright (C) 2018 by the Institute of
  225. Electrical and Electronics Engineers, Inc and The Open Group.
  226. In the event of any discrepancy between this version and the original IEEE and
  227. The Open Group Standard, the original IEEE and The Open Group Standard
  228. is the referee document. The original Standard can be obtained online at
  229. http://www.opengroup.org/unix/online.html .
  230. .PP
  231. Any typographical or formatting errors that appear
  232. in this page are most likely
  233. to have been introduced during the conversion of the source files to
  234. man page format. To report such errors, see
  235. https://www.kernel.org/doc/man-pages/reporting_bugs.html .