Name
wcstol, wcstoul, wcstoll, wcstoull, wcstoimax, wcstoumax, wcstoq, wcstouq
- convert a wide-character string to a long integer
long ,
unsigned long ,
long long ,
unsigned long long ,
intmax_t
or
uintmax_t
long long ,
unsigned long long ,
integer
Library
libc.lib
Synopsis
|
long
wcstol (const wchar_t * restrict src, wchar_t ** restrict endptr, int base);
|
|
unsigned long
wcstoul (const wchar_t * restrict src, wchar_t ** restrict endptr, int base);
|
|
long long
wcstoll (const wchar_t * restrict src, wchar_t ** restrict endptr, int base);
|
|
unsigned long long
wcstoull (const wchar_t * restrict src, wchar_t ** restrict endptr, int base);
|
|
long long
wcstoq (const wchar_t * restrict src, wchar_t ** restrict endptr, int base);
|
|
unsigned long long
wcstouq (const wchar_t * restrict src, wchar_t ** restrict endptr, int base);
|
|
intmax_t
wcstoimax (const wchar_t * restrict src, wchar_t ** restrict endptr, int base);
|
|
uintmax_t
wcstoumax (const wchar_t * restrict src, wchar_t ** restrict endptr, int base);
|
Return values
errno
may be set to indicate the error. If the correct value is outside the range of representable values, {LONG_MIN}, {LONG_MAX},
{LLONG_MIN}, or {LLONG_MAX} shall be returned (according to the sign of the value), and
errno
set to [ERANGE].
Detailed 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)
for details.
The
wcstoq
and
wcstouq
are respectively equivalent to
wcstoll
and
wcstoull.
Examples
#include <wchar.h>
/* Illustrates how to use wcstoumax API */
uintmax_t example_wcstoumax()
{
/* src string */
wchar_t *src = L"478";
uintmax_t longVal;
/* convert the wide character string to uintmax_t */
longVal = wcstoumax(src,NULL,10);
/* return the converted long value */
return longVal;
}
#include <wchar.h>
/* Illustrates how to use wcstoimax API */
intmax_t example_wcstoimax()
{
/* src string */
wchar_t *src = L"478";
intmax_t longVal;
/* convert the wide character string to intmax_t */
longVal = wcstoimax(src,NULL,10);
/* return the converted long value */
return longVal;
}
#include <wchar.h>
/* Illustrates how to use wcstol API */
long example_wcstol()
{
/* src string */
wchar_t *src = L"478";
long longVal;
/* call the API to convert src string to long value */
longVal = wcstol(src,NULL,10);
/* return the converted long value */
return longVal;
}
#include <wchar.h>
/* Illustrates how to use wcstoul API */
unsigned long example_wcstoul()
{
/* src string */
wchar_t *src = L"478";
unsigned long longVal;
/* call the API to convert src string to unsigned */
/* long value */
longVal = wcstoul(src,NULL,10);
/* return the converted long value */
return longVal;
}
#include <wchar.h>
/* Illustatrates how to use wcstoll API */
long long example_wcstoll()
{
/* input string for which length to be found */
wchar_t *src = L"478";
long long longVal;
/* perform the conversion operation from wide */
/* char string to long long value */
longVal = wcstoll(src,NULL,10);
return longVal;
}
#include <wchar.h>
/* Illustatrates how to use wcstoull API */
unsigned long long example_wcstoull()
{
/* input string for which length to be found */
wchar_t *src = L"478";
unsigned long long longVal;
/* perform the conversion operation from wide */
/*char string to unsigned long long value */
longVal = wcstoull(src,NULL,10);
return longVal;
}
#include <wchar.h>
/* Illustrates how to use wcstoq API */
long long int example_wcstoq()
{
/* src string that contains decimal digits */
wchar_t *src = L"478";
long long int longVal;
/* convert the decimal wide char string to long long int value */
longVal = wcstoq(src,NULL,10);
/* return longVal and its value should be 478 */
return longVal;
}
#include <wchar.h>
/* Illustrates how to use wcstouq API */
unsigned long long int example_wcstouq()
{
/* src string that contains decimal digits */
wchar_t *src = L"478";
unsigned long long int longVal;
/* convert the decimal wide char string to unsigned long long int value */
longVal = wcstouq(src,NULL,10);
/* return longVal, which should be 478 */
return longVal;
}
See also
strtol,
strtoul
The
wcstol,
wcstoul,
wcstoll,
wcstoull,
wcstoimax
and
wcstoumax
functions conform to
-isoC-99.
Feedback
For additional information or queries on this page send feedback
© 2005-2007 Nokia
|
|