Scroll Down to See All▾
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1ynFunction Details : wcsrtombs
size_twcsrtombs(char * dest,const wchar_t ** src,size_t len,mbstate_t * ps) ;
Return Type : size_t
Platform-specific unsigned type for array indices and memory sizes.
Read about return values of wcsrtombs function .
1st Parameter Type : char *
String pointer (array of characters)
1st Parameter
Pointer to the destination buffer where the multibyte sequence will be stored.
2nd Parameter Type : const wchar_t **
Type const wchar_t ** parameters
2nd Parameter
Pointer to a pointer to the source wide-character string to be converted.
3rd Parameter Type : size_t
Platform-specific unsigned type for array indices and memory sizes.
3rd Parameter
Maximum number of bytes to write to `dest`.
4th Parameter Type : mbstate_t *
A pointer to an `mbstate_t` object that represents the current shift state for multibyte to wide character conversions. This pointer allows modification of the state during the conversion process.
4th Parameter
Pointer to a conversion state object used for multibyte conversions.
Read more about parameters of wcsrtombs in parameters section
The wcsrtombsfunction in C language Converts a sequence of wide characters from a wide character string to a multibyte string, considering the current locale.
wcsrtombs converts a sequence of wide characters from the array indirectly pointed to by src into a sequence of corresponding multibyte characters that begins in the initial shift state described by ps. If dst is not a null pointer, the converted characters are then stored into the array pointed to by dst. Conversion continues up to and including a terminating null wide character, which is also converted.
The wcsrtombsfunction takes 4
parameters:Converts a wide-character string to a multibyte string, using the state object `ps`. Returns the number of bytes written to `dest` or `(size_t)-1` if an error occurs.
- •char * `dest`: Pointer to the destination buffer where the multibyte sequence will be stored.
- •const wchar_t ** `src`: Pointer to a pointer to the source wide-character string to be converted.
- •size_t `len`: Maximum number of bytes to write to `dest`.
- •mbstate_t * `ps`: Pointer to a conversion state object used for multibyte conversions.
The wcsrtombs function return value :
- If dst is not NULL, returns the number of bytes in the resulting multibyte character sequence, not including the terminating null byte
- If dst is NULL, returns the required size of the destination string
- If an invalid wide character is encountered, (size_t)(-1) is returned and errno is set to EILSEQ
Output
This example demonstrates the basic usage of wcsrtombs to convert a wide character string to a multibyte string.