version 1 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
STRTOUL |
|
|
2 |
!!!STRTOUL |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
ERRORS |
|
|
8 |
CONFORMING TO |
|
|
9 |
SEE ALSO |
|
|
10 |
BUGS |
|
|
11 |
---- |
|
|
12 |
!!NAME |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
strtoul - convert a string to an unsigned long integer. |
|
|
16 |
!!SYNOPSIS |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
__#include |
|
|
20 |
__''nptr''__, char **__''endptr''__, |
|
|
21 |
int__ base__) |
|
|
22 |
__ |
|
|
23 |
!!DESCRIPTION |
|
|
24 |
|
|
|
25 |
|
|
|
26 |
The __strtoul()__ function converts the string in |
|
|
27 |
''nptr'' to an unsigned long integer value according to |
|
|
28 |
the given ''base'', which must be between 2 and 36 |
|
|
29 |
inclusive, or be the special value 0. |
|
|
30 |
|
|
|
31 |
|
|
|
32 |
The string must begin with an arbitrary amount of white |
|
|
33 |
space (as determined by isspace(3)) followed by a |
|
|
34 |
single optional `+' or `-' sign. If ''base'' is zero or |
|
|
35 |
16, the string may then include a `0x' prefix, and the |
|
|
36 |
number will be read in base 16; otherwise, a zero |
|
|
37 |
''base'' is taken as 10 (decimal) unless the next |
|
|
38 |
character is `0', in which case it is taken as 8 |
|
|
39 |
(octal). |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
The remainder of the string is converted to an unsigned long |
|
|
43 |
int value in the obvious manner, stopping at the first |
|
|
44 |
character which is not a valid digit in the given base. (In |
|
|
45 |
bases above 10, the letter `A' in either upper or lower case |
|
|
46 |
represents 10, `B' represents 11, and so forth, with `Z' |
|
|
47 |
representing 35.) |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
If ''endptr'' is not NULL, __strtoul()__ stores the |
|
|
51 |
address of the first invalid character in ''*endptr''. If |
|
|
52 |
there were no digits at all, __strtoul()__ stores the |
|
|
53 |
original value of ''nptr'' in ''*endptr''. (Thus, if |
|
|
54 |
''*nptr'' is not `0' but ''**endptr'' is `0' on |
|
|
55 |
return, the entire string is valid.) |
|
|
56 |
!!RETURN VALUE |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
The __strtoul()__ function returns either the result of |
|
|
60 |
the conversion or, if there was a leading minus sign, the |
|
|
61 |
negation of the result of the conversion, unless the |
|
|
62 |
original (non-negated) value would overflow; in the latter |
|
|
63 |
case, __strtoul()__ returns ULONG_MAX and sets the global |
|
|
64 |
variable ''errno'' to ERANGE. |
|
|
65 |
!!ERRORS |
|
|
66 |
|
|
|
67 |
|
|
|
68 |
__ERANGE__ |
|
|
69 |
|
|
|
70 |
|
|
|
71 |
The given string was out of range; the value converted has |
|
|
72 |
been clamped. |
|
|
73 |
!!CONFORMING TO |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
SVID 3, BSD 4.3, ISO 9899 |
|
|
77 |
!!SEE ALSO |
|
|
78 |
|
|
|
79 |
|
|
|
80 |
atof(3), atoi(3), atol(3), |
|
|
81 |
strtod(3), strtol(3) |
|
|
82 |
!!BUGS |
|
|
83 |
|
|
|
84 |
|
|
|
85 |
Ignores the current locale. |
|
|
86 |
---- |