Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ watoi(3I) — SunOS 5.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

wctype(3I)

scanf(3S)

wstol(3I)

NAME

wstol, watol, watoll, watoi − convert a Process Code string to integer

SYNOPSIS

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);

MT-LEVEL

MT-Safe

DESCRIPTION

wstol() returns as a long integer the value represented by the wide character string pointed to by str. The string is scanned up to the first character inconsistent with 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.  Characters used in this string must be ASCII digits. 

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. 

watol() is equivalent to wstol(str, (wchar_t ∗∗)NULL, 10). 

watoll() is the long-long (double long) version of watol(). 

watoi() is equivalent to (int)watol(). 

Of course truncation from long long to long can take place upon assignment or by an explicit cast. 

SEE ALSO

wctype(3I), scanf(3S)

BUGS

Overflow conditions are ignored. 

SunOS 5.2  —  Last change: 10 Feb 1993

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026