a64l()

NAME

a64l(), l64a() - convert between a 32-bit integer and radix-64 ASCII

SYNOPSIS

#include <stdlib.h>

long a64l (const char *s) char l64a (long value)

DESCRIPTION

The a64l(3) and l64a(3) calls convert numbers between 32-bit integer format and the radix-64 ASCII notation. In radix-64, a 32-bit integer can be represented by up to six characters, and each character represents a digit. (On INTERIX, a long is 32 bits; on systems where a long is more than 32 bits, these calls only deal with the low order 32 bits of the number.) call.

The s argument to a64l(3) is an ASCII string, where the first digit is the least significant. The characters represent digits as follows:

Character(s) Digits
. 0
/ 1
0-9 2-11
A-Z 12-37
a-z 38-63

If s is longer than six characters, a64l(3) only uses the first six; if the first six characters contain a NUL character, only the characters before the NUL are used.

The l64a(3) function takes a long argument and returns a pointer to the corresponding radix-64 representation.

RETURN VALUES

The a64l(3) call returns a long value. If s is an empty string, a64l(3) returns 0L. If s is NULL, a64l(3) returns -1L and sets errno to indicate the error.

The l64a(3) call returns a pointer to a static buffer that contains the radix-64 representation. If value is 0L, l64a(3) returns an empty string. If value is negative, l64a(3) returns NULL and sets errno to indicate the error.

ERRORS

The a64l(3) and l64a(3) calls can fail for the following reasons:

[EINVAL]
The string s was a NULL pointer, or the value of value was negative.

SEE ALSO

strtoul(3)