Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

a64l, l64a - convert string to 32-bit integer

&pagelevel(4)&pagelevel

 

Syntax

#include <stdlib.h>

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

Description

These functions are used to manage numbers stored in radix-64 ASCII characters. These
characters define a notation with which long integers can be represented by a maximum of
six characters; each character represents a ’digit’ in a base 64 notation.

The characters used to represent ’digits’ are . for 0, / for 1, 0 through 9 for 2-11, A through
Z for 12-37 and a through z for 38-63.

a64l() expects a pointer to a base 64 representation ending in a null byte, and returns the
corresponding long value. If the string pointed to by s contains more than six characters,
a64l() uses the first six characters. If the passed string was empty, the return value is 0L.

a64l() runs through the string from left to right (with the least significant digit on the left)
and decodes each character as a 6-bit number in base 64. If the type long contains
more than 32 bits, the result is prefixed with a sign. The behavior of a64l() is undefined
if s is the null pointer or if the string pointed to by s was not generated by a previous call of
l64a().

l64a() expects a long argument and returns a pointer to the corresponding base 64
representation. If the argument is 0, l64a() returns a pointer to a null string. The behavior
of l64a() is undefined if the value of the argument is negative.

Return val.

a64l():

Integer value of type long


for strings with a structure like the one described above.

0L
Undefined

for empty strings.
if s is the null pointer or if the string was not generated by a previous call of
l64a(). errno is set to indicate the error.

l64a():


Pointer to a string represented in base 64

for value > 0

Pointer to an empty string


for value = 0

Undefined

for value < 0

Errors

a64l() fails if the following applies:

ERANGE      The result cannot be represented.

Notes

The value returned by l64a() is a pointer to a static buffer, whose contents are overwritten
with each call.

If the type long contains more than 32 bits, the result of a64l(l64a(l)) occupies the 32
least significant bits.

See also

strtoul(), stdlib.h