1<html lang="en"> 2<head> 3<title>wcstoul - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Stdlib.html#Stdlib" title="Stdlib"> 9<link rel="prev" href="wcstoll.html#wcstoll" title="wcstoll"> 10<link rel="next" href="wcstoull.html#wcstoull" title="wcstoull"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<meta http-equiv="Content-Style-Type" content="text/css"> 13<style type="text/css"><!-- 14 pre.display { font-family:inherit } 15 pre.format { font-family:inherit } 16 pre.smalldisplay { font-family:inherit; font-size:smaller } 17 pre.smallformat { font-family:inherit; font-size:smaller } 18 pre.smallexample { font-size:smaller } 19 pre.smalllisp { font-size:smaller } 20 span.sc { font-variant:small-caps } 21 span.roman { font-family:serif; font-weight:normal; } 22 span.sansserif { font-family:sans-serif; font-weight:normal; } 23--></style> 24<link rel="stylesheet" type="text/css" href="../cs.css"> 25</head> 26<body> 27<div class="node"> 28<a name="wcstoul"></a> 29<p> 30Next: <a rel="next" accesskey="n" href="wcstoull.html#wcstoull">wcstoull</a>, 31Previous: <a rel="previous" accesskey="p" href="wcstoll.html#wcstoll">wcstoll</a>, 32Up: <a rel="up" accesskey="u" href="Stdlib.html#Stdlib">Stdlib</a> 33<hr> 34</div> 35 36<h3 class="section">2.43 <code>wcstoul</code>—wide string to unsigned long</h3> 37 38<p><a name="index-wcstoul-102"></a><a name="index-g_t_005fwcstoul_005fr-103"></a><strong>Synopsis</strong> 39<pre class="example"> #include <wchar.h> 40 unsigned long wcstoul(const wchar_t *<var>s</var>, wchar_t **<var>ptr</var>, 41 int <var>base</var>); 42 43 unsigned long _wcstoul_r(void *<var>reent</var>, const wchar_t *<var>s</var>, 44 wchar_t **<var>ptr</var>, int <var>base</var>); 45 46</pre> 47 <p><strong>Description</strong><br> 48The function <code>wcstoul</code> converts the wide string <code>*</code><var>s</var> to 49an <code>unsigned long</code>. First, it breaks down the string into three parts: 50leading whitespace, which is ignored; a subject string consisting 51of the digits meaningful in the radix specified by <var>base</var> 52(for example, <code>0</code> through <code>7</code> if the value of <var>base</var> is 8); 53and a trailing portion consisting of one or more unparseable characters, 54which always includes the terminating null character. Then, it attempts 55to convert the subject string into an unsigned long integer, and returns the 56result. 57 58 <p>If the value of <var>base</var> is zero, the subject string is expected to look 59like a normal C integer constant (save that no optional sign is permitted): 60a possible <code>0x</code> indicating hexadecimal radix, and a number. 61If <var>base</var> is between 2 and 36, the expected form of the subject is a 62sequence of digits (which may include letters, depending on the 63base) representing an integer in the radix specified by <var>base</var>. 64The letters <code>a</code>–<code>z</code> (or <code>A</code>–<code>Z</code>) are used as digits valued from 6510 to 35. If <var>base</var> is 16, a leading <code>0x</code> is permitted. 66 67 <p>The subject sequence is the longest initial sequence of the input 68string that has the expected form, starting with the first 69non-whitespace character. If the string is empty or consists entirely 70of whitespace, or if the first non-whitespace character is not a 71permissible digit, the subject string is empty. 72 73 <p>If the subject string is acceptable, and the value of <var>base</var> is zero, 74<code>wcstoul</code> attempts to determine the radix from the input string. A 75string with a leading <code>0x</code> is treated as a hexadecimal value; a string with 76a leading <code>0</code> and no <code>x</code> is treated as octal; all other strings are 77treated as decimal. If <var>base</var> is between 2 and 36, it is used as the 78conversion radix, as described above. Finally, a pointer to the first 79character past the converted subject string is stored in <var>ptr</var>, if 80<var>ptr</var> is not <code>NULL</code>. 81 82 <p>If the subject string is empty (that is, if <code>*</code><var>s</var> does not start 83with a substring in acceptable form), no conversion 84is performed and the value of <var>s</var> is stored in <var>ptr</var> (if <var>ptr</var> is 85not <code>NULL</code>). 86 87 <p>The alternate function <code>_wcstoul_r</code> is a reentrant version. The 88extra argument <var>reent</var> is a pointer to a reentrancy structure. 89 90 <p><br> 91<strong>Returns</strong><br> 92<code>wcstoul</code> returns the converted value, if any. If no conversion was 93made, <code>0</code> is returned. 94 95 <p><code>wcstoul</code> returns <code>ULONG_MAX</code> if the magnitude of the converted 96value is too large, and sets <code>errno</code> to <code>ERANGE</code>. 97 98 <p><br> 99<strong>Portability</strong><br> 100<code>wcstoul</code> is ANSI. 101 102 <p><code>wcstoul</code> requires no supporting OS subroutines. 103 104 <p><br> 105 106 </body></html> 107 108