str2s(3)

Name
str2s, str2shh, str2sh, str2si, str2sl, str2sll, - convert a string to a signed integer

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

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

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

int
str2shh( signed char *restrict n, const char *s);
int
str2sh( short *restrict n, const char *s);
int
str2si( int *restrict n, const char *s);
int
str2sl( long *restrict n, const char *s);
int
str2sll( long long *restrict n, const char *s);

Description
These functions and macro are convenience wrappers around a2s(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:

    str2sl(&n, s);
    str2s(long, &n, s);
    str2i(long, &n, s);
    a2sl(&n, s, NULL, 0, LONG_MIN, LONG_MAX);
    a2s(long, &n, s, NULL, 0, LONG_MIN, LONG_MAX);
    a2i(long, &n, s, NULL, 0, LONG_MIN, LONG_MAX);

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