API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

STD_SCANULL()

Brew Release
Brew MP 1.0.2
See Also
std_scanul()
Description

The std_scanull() converts an ASCII representation of a number to an unsigned long long. It expects strings that match the following pattern:
         spaces [+|-] digits

'Spaces' is zero or more ASCII space or tab characters.
'Digits' is any number of digits valid in the radix. Letters 'A' through 'Z' are treated as digits with values 10 through 35. 'Digits' may begin with "0x" when a radix of 0 or 16 is specified.
Upper and lower case letters can be used interchangeably.

Params
pchBuf
[in]:
the start of the string to scan.
nRadix
[in]:
the numeric radix (or base) of the number. Valid values are 2 through 36 or zero, which implies auto-detection. Auto-detection examines the digits field. If it begins with "0x", radix 16 is selected. Otherwise, if it begins with "0" radix 8 is selected. Otherwise, radix 10 is selected.
ppchEnd
[out]:
if ppchEnd is not NULL, *ppchEnd points to the first character that did not match the expected pattern shown above, except on STD_BADPARAM and STD_OVERFLOW when it is set to the start of the string.
pnError
[out]:
If pnError is not NULL, *pnError holds the error code, which is one of the
Interface
Prototype
  •     uint64 std_scanull(const char *pchBuf, int nRadix, const char **ppchEnd,
                           int *pnError)
    
Return

  • The converted numeric result.
Comments
The std_scanull() is similar to ANSI C's strtoull() but differs in the following respects: 1. It returns an error/success code. strtoull() results are ambiguous unless the caller sets errno to zero before calling it. 2. std_scanull() is free of references to current locale and errno. Some strtoull() implementations use locale; some don't. 3. It provides more complete reporting of range underflow. strtoul() does not distinguish between "-1" and "0xFFFFFFFFFFFFFFFF", and underflow is poorly defined. 4. std_scanull() reports a "no digits" error code to distinguish "0" from whitespace, "+", etc..