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

wcstol.3p (6568B)


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