Welcome to little lamb

Code » limb » release » tree

[release] / src / doc / u16.h / u16_scan.3.md

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

# NAME

u16_scan, u16_scan0 - Read an u16 value from a decimal string

u16_xscan, u16_xscan0 - Read an u16 value from an hexadecimal string

u16_oscan, u16_oscan0 - Read an u16 value from an octal string

u16_bscan, u16_bscan0 - Read an u16 value from a binary string


# SYNOPSIS

    #include <limb/u16.h>

```pre hl
size_t u16_scan(u16 *<em>dst</em>, const char *<em>s</em>)
size_t u16_scan0(u16 *<em>dst</em>, const char *<em>s</em>)

size_t u16_xscan(u16 *<em>dst</em>, const char *<em>s</em>)
size_t u16_xscan0(u16 *<em>dst</em>, const char *<em>s</em>)

size_t u16_oscan(u16 *<em>dst</em>, const char *<em>s</em>)
size_t u16_oscan0(u16 *<em>dst</em>, const char *<em>s</em>)

size_t u16_bscan(u16 *<em>dst</em>, const char *<em>s</em>)
size_t u16_bscan0(u16 *<em>dst</em>, const char *<em>s</em>)
```

# DESCRIPTION

The `u16_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 `u16_scan0`() function is similar but expects the string to contain a valid
value and nothing else, stopping with a NUL-terminating byte.

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

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

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


# RETURN VALUE

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

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

# ERRORS

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

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

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