Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / u64.h / u64_scan.3.md

% limb manual
% u64_scan(3)
% limb 0.1.0
% 2023-07-24

# NAME

u64_scan, u64_scan0 - Read an u64 value from a decimal string

u64_xscan, u64_xscan0 - Read an u64 value from an hexadecimal string

u64_oscan, u64_oscan0 - Read an u64 value from an octal string

u64_bscan, u64_bscan0 - Read an u64 value from a binary string


# SYNOPSIS

    #include <limb/u64.h>

```pre hl
size_t u64_scan(u64 *<em>dst</em>, const char *<em>s</em>)
size_t u64_scan0(u64 *<em>dst</em>, const char *<em>s</em>)

size_t u64_xscan(u64 *<em>dst</em>, const char *<em>s</em>)
size_t u64_xscan0(u64 *<em>dst</em>, const char *<em>s</em>)

size_t u64_oscan(u64 *<em>dst</em>, const char *<em>s</em>)
size_t u64_oscan0(u64 *<em>dst</em>, const char *<em>s</em>)

size_t u64_bscan(u64 *<em>dst</em>, const char *<em>s</em>)
size_t u64_bscan0(u64 *<em>dst</em>, const char *<em>s</em>)
```

# DESCRIPTION

The `u64_scan`() function will place into `dst` the number read as a decimal
value from the string `s`, stopping as soon as a character isn't valid.

The `u64_scan0`() function is similar but expects the string to contain a valid
value and nothing else, stopping with a NUL-terminating byte.

The `u64_xscan`() and `u64_xscan0`() functions are similar, but expecting an
hexadecimal value in `s`.

The `u64_oscan`() and `u64_oscan0`() functions are similar, but expecting an
octal value in `s`.

The `u64_bscan`() and `u64_bscan0`() functions are similar, but expecting a
binary value in `s`.


# RETURN VALUE

The `u64_*scan` family of functions return the number of characters read from
`s` (starting at 0 when the first character is invalid).

The `u64_*scan0` family of functions return the number of characters read from
`s` or 0 on error.

# ERRORS

The `u64_*scan0` family of functions may fail and set `errno` if :

: *EINVAL*
:: Invalid character in `s`

: *ERANGE*
:: The value in `s` is too large