1scan_ulong(3)              Library Functions Manual              scan_ulong(3)
2
3
4

NAME

6       scan_ulong  - parse an unsigned long integer in decimal ASCII represen‐
7       tation
8

SYNTAX

10       #include <scan.h>
11
12       size_t scan_ulong(const char *src,unsigned long *dest);
13

DESCRIPTION

15       scan_ulong parses an unsigned long integer in decimal ASCII representa‐
16       tion from src and writes the result into dest. It returns the number of
17       bytes read from src.
18
19       Leading + or - or space (or anything outside of 0-9) is  not  accepted.
20       The  libc  conventions of "023" for octal or "0x23" for hexadecimal are
21       not supported.
22
23       scan_ulong will abort the scan if the next character is not a digit, or
24       if  it  is a digit but adding it to the number would lead to an integer
25       overflow.
26

RETURN VALUE

28       scan_ulong returns the number of characters  successfully  scanned  and
29       processed from src.
30

EXAMPLES

32       scan_ulong("23",&i) -> i=23, return 2
33
34       scan_ulong("+23",&i) -> return 0
35
36       scan_ulong("-23",&i) -> return 0
37
38       scan_ulong(" 23",&i) -> return 0
39
40       scan_ulong("23,42",&i) -> i=23, return 2
41
42       scan_ulong("023",&i) -> i=23, return 3
43
44       scan_ulong("0x23",&i) -> i=0, return 1
45
46       scan_ulong("4294967296",&i") -> i=429496729, return 9 // 32-bit system
47

SEE ALSO

49       scan_xlong(3), scan_8long(3), fmt_ulong(3)
50
51
52
53                                                                 scan_ulong(3)
Impressum