---
name: "wcstol"
section: "3"
platform: "macos"
package: "Libc"
version: "1752.120.2"
release: "macOS 26.5"
platforms: ["freebsd", "macos"]
url: "https://new.carta.tech/wcstol"
---

# wcstol(3)

convert a wide character string value to a intmax\_t, long, long long, unsigned long, unsigned long long, or uintmax\_t integer

## NAME

**wcstoimax**, **wcstol**, **wcstoll**, **wcstoul**, **wcstoull**, **wcstoumax** – convert a wide character string value to a *intmax\_t*, *long*, *long long*, *unsigned long*, *unsigned long long*, or *uintmax\_t* integer

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<wchar.h\>**

*long*\

**wcstol**(*const wchar\_t \*restrict nptr*, *wchar\_t \*\*restrict endptr*, *int base*);

*long long*\

**wcstoll**(*const wchar\_t \*restrict nptr*, *wchar\_t \*\*restrict endptr*, *int base*);

*unsigned long*\

**wcstoul**(*const wchar\_t \*restrict nptr*, *wchar\_t \*\*restrict endptr*, *int base*);

*unsigned long long*\

**wcstoull**(*const wchar\_t \*restrict nptr*, *wchar\_t \*\*restrict endptr*, *int base*);

**#include \<stddef.h\>**

**#include \<inttypes.h\>**

*intmax\_t*\

**wcstoimax**(*const wchar\_t \*restrict nptr*, *wchar\_t \*\*restrict endptr*, *int base*);

*uintmax\_t*\

**wcstoumax**(*const wchar\_t \*restrict nptr*, *wchar\_t \*\*restrict endptr*, *int base*);

## DESCRIPTION

The **wcstol**(), **wcstoul**(), **wcstoll**(), **wcstoull**(), **wcstoimax**(), and **wcstoumax**() functions are wide-character versions of the **strtol**(), **strtoul**(), **strtoll**(), **strtoull**(), **strtoimax**(), and **strtoumax**() functions, respectively. Refer to their manual pages (for example [strtol(3)](/strtol/3.md)) for details.

Extended locale versions of these functions are documented in [wcstol\_l(3)](/wcstol_l/3.md). See [xlocale(3)](/xlocale/3.md) for more information.

## LEGACY SYNOPSIS

**#include \<stddef.h\>** **#include \<inttypes.h\>**

The include file ⟨stddef.h⟩ is necessary for the **wcstoimax**() and **wcstoumax**() functions.

## SEE ALSO

[strtol(3)](/strtol/3.md), [strtoul(3)](/strtoul/3.md), [wcstol\_l(3)](/wcstol_l/3.md), [compat(5)](/compat/5.md)

## STANDARDS

The **wcstol**(), **wcstoul**(), **wcstoll**(), **wcstoull**(), **wcstoimax**(), and **wcstoumax**() functions conform to ISO/IEC 9899:1999 (“ISO C99”).
