expand_number.3bsd - Man Page
format a number from human readable form
Library
library “libbsd”
Synopsis
#include <libutil.h
> (See libbsd(7) for include usage.)
int
expand_number
(const char *buf, uint64_t *num);
Description
The expand_number
() function unformats the buf string and stores a unsigned 64-bit quantity at address pointed out by the num argument.
The expand_number
() function follows the SI power of two convention.
The prefixes are:
Return Values
Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.
Errors
The expand_number
() function will fail if:
- [EINVAL]
The given string contains no digits.
- [EINVAL]
An unrecognized prefix was given.
- [ERANGE]
Result doesn't fit into 64 bits.
See Also
humanize_number(3bsd)
History
The expand_number
() function first appeared in FreeBSD 6.3.