Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : wcstol

longwcstol(const wchar_t * nptr,wchar_t ** endptr,int base) ;

Return Type : long

Large integer type (4 or 8 bytes platform dependent)
Read about return values of wcstol function .

1st Parameter Type : const wchar_t *

A pointer to a read-only wide-character string, where each character is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets, such as Unicode. The string is null-terminated, with the terminator being a `wchar_t` with value 0.

1st Parameter

Pointer to the null-terminated wide-character string to be converted.

2nd Parameter Type : wchar_t **

Type wchar_t ** parameters

2nd Parameter

Pointer to a pointer to a wide character. It is set to the character in `nptr` where the conversion stopped.

3rd Parameter Type : int

Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)

3rd Parameter

The base of the number to be converted (e.g., 10 for decimal, 16 for hexadecimal). If 0, the base is automatically determined from the string format.

Read more about parameters of wcstol in parameters section
The wcstolfunction in C language Converts the initial portion of a wide character string to a long integer.
wcstol converts the initial portion of the wide-character string pointed to by nptr to a long integer representation. It skips leading whitespace, recognizes an optional sign, and converts the subsequent sequence of digits. The conversion is done according to the given base, which must be between 2 and 36 inclusive, or be the special value 0.
The wcstolfunction takes 3 parameters:
  • const wchar_t * `nptr`: Pointer to the null-terminated wide-character string to be converted.
  • wchar_t ** `endptr`: Pointer to a pointer to a wide character. It is set to the character in `nptr` where the conversion stopped.
  • int `base`: The base of the number to be converted (e.g., 10 for decimal, 16 for hexadecimal). If 0, the base is automatically determined from the string format.
Converts the initial part of the wide-character string `nptr` to a `long` integer value according to the given `base`. If `endptr` is not `NULL`, it points to the first character after the number that was converted.
The wcstol function return value :
  • Returns the converted value, if any
  • If no conversion could be performed, 0 is returned
  • If the correct value is outside the range of representable values, LONG_MAX or LONG_MIN is returned, and errno is set to ERANGE

Output

This example demonstrates the basic usage of wcstol to convert a wide string to a long integer.