str2u(3)

Name
str2u, str2uhh, str2uh, str2ui, str2ul, str2ull - convert a string to an unsigned integer

Library
String-to-integer library (liba2i, -la2i)

Synopsis
#include <a2i/str2i/str2u.h>

int
str2u( TYPE, TYPE *restrict n, const char *s);

int
str2uhh( unsigned char *restrict n, const char *s);
int
str2uh( unsigned short *restrict n, const char *s);
int
str2ui( unsigned int *restrict n, const char *s);
int
str2ul( unsigned long *restrict n, const char *s);
int
str2ull( unsigned long long *restrict n, const char *s);

Description
These functions and macros are convenience wrappers around a2u(3), providing common defaults for the remaining arguments. The base is 0; the end pointer is NULL; and the limits are those of the type.

Examples
The following calls are all equivalent:

    str2ul(&n, s);
    str2u(unsigned long, &n, s);
    str2i(unsigned long, &n, s);
    a2ul(&n, s, NULL, 0, 0, ULONG_MAX);
    a2u(unsigned long, &n, s, NULL, 0, 0, ULONG_MAX);
    a2i(unsigned long, &n, s, NULL, 0, 0, ULONG_MAX);

See also
a2i(3), a2s(3), a2u(3), str2i(3), str2s(3)