wstol(3I)
NAME
wstol, watol, watoll, watoi − convert a Process Code string to integer
SYNOPSIS
LP cc [ flag ... ] file ... −lw [ library ... ]
#include <widec.h>
long wstol(wchar_t ∗str, wchar_t ∗∗ptr, int base);
long watol(wchar_t ∗str);
long long watoll(wchar_t ∗str);
int watoi(wchar_t ∗str);
DESCRIPTION
wstol() returns as a long integer the value represented by the wchar_t string pointed to by str. The string is scanned up to the first character inconsistent with the base.
wstol() recognizes a string that starts with an optional number of white space characters, as defined by iswspace in wctype(3I), followed by an optional “+” or “-” symbol, then a decimal numeric string that may include a decimal point, followed by an optional “e” or “E”, with an optional “+”, “-” or space, and an integer. The characters used in this string are ASCII characters.
If the value of ptr is not (wchar_t ∗∗)NULL, a pointer to the character terminating the scan is returned in the location pointed to by ptr. If no integer can be formed, that location is set to str, and zero is returned.
If base is positive (and not greater than 36), it is used as the base for conversion. After an optional leading sign, leading zeros are ignored, and “0x” or “0X” is ignored if base is 16.
If base is zero, the string itself determines the base after an optional leading sign a leading zero indicates octal conversion, and a leading “0x” or “0X” hexadecimal conversion. Otherwise, decimal conversion is used.
Truncation from long to int can, of course, take place upon assignment or by an explicit cast.
watol() is equivalent to wstol(str, (wchar_t ∗∗)NULL, 10).
watoll() is equivalent to (long long)wstol( str, (wchar_t ∗∗)NULL, 10).
watoi() is equivalent to (int)wstol(str, (wchar_t ∗∗)NULL, 10).
SEE ALSO
BUGS
Overflow conditions are ignored.
SunOS 5.1/SPARC — Last change: 28 Feb 1992