1STRICT_STRTOUL(9) Basic C Library Functions STRICT_STRTOUL(9)
2
3
4
6 strict_strtoul - convert a string to an unsigned long strictly
7
9 int strict_strtoul(const char * cp, unsigned int base,
10 unsigned long * res);
11
13 cp
14 The string to be converted
15
16 base
17 The number base to use
18
19 res
20 The converted result value
21
23 strict_strtoul converts a string to an unsigned long only if the string
24 is really an unsigned long string, any string containing any invalid
25 char at the tail will be rejected and -EINVAL is returned, only a
26 newline char at the tail is acceptible because people generally
27
29 echo 1024 > /sys/module/e1000/parameters/copybreak
30
31 echo will append a newline to the tail.
32
33 It returns 0 if conversion is successful and *res is set to the
34 converted value, otherwise it returns -EINVAL and *res is set to 0.
35
36 simple_strtoul just ignores the successive invalid characters and
37 return the converted value of prefix part of the string.
38
40Kernel Hackers Manual 2.6. November 2011 STRICT_STRTOUL(9)