wcstol(3C) wcstol(3C)
NAME
wcstol - convert a wide character string to a long integer
SYNOPSIS
#include <wchar.h>
long wcstol(const wchar_t *nptr, wchar_t **endptr, int base);
long wcstoul(const wchar_t *nptr, wchar_t **endptr, int base);
DESCRIPTION
wcstol returns, as a long integer, the value represented by
the character string pointed to by nptr. wcstoul returns, as
an unsigned long integer, the value represented by the
character string pointed to by nptr. The string is scanned up
to the first character inconsistent with the base. Leading
``white-space'' characters [as defined by iswspace] are
ignored.
If the value of endptr is not a null pointer, a pointer to the
wide character terminating the scan is returned in the
location pointed to by endptr. If no integer can be formed,
that location is set to nptr, and zero is returned.
If base is between 2 and 36, inclusive, it is used as the base
for conversion. After an optional leading sign, leading zeros
are ignored, and a leading ``0x'' or ``0X'' is ignored if base
is 16 and a leading )b or 0B is ignored if base is 2.
If base is zero, the string itself determines the base as
follows: After an optional leading sign a leading zero
indicates octal conversion, and a leading ``0x'' or ``0X''
hexadecimal conversion. Otherwise, decimal conversion is
used.
Return Values
For wcstol, if the value represented by nptr would cause
overflow, LONG_MAX or LONG_MIN is returned (according to the
sign of the value), and errno is set to the value ERANGE.
For wcstoul, if the value represented by nptr would cause
overflow, ULONG_MAX is returned, and errno is set to the value
ERANGE.
If wcstol or wcstoul is given a base other than zero or 2
through 36, it returns zero and sets errno to EINVAL.
Otherwise, wcstol and wcstoul return the represented value.
Copyright 1994 Novell, Inc. Page 1
wcstol(3C) wcstol(3C)
Errors
In the following conditions, wcstol fails and sets errno to:
EINVAL The value of base is not supported.
EINVAL No conversion could be performed.
ERANGE The value to be returned is not representable.
REFERENCES
fscanf(3S), wchar(5), wcstod(3C)
Copyright 1994 Novell, Inc. Page 2