Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : wctomb

intwctomb(char * s,wchar_t wc) ;

Return Type : int

Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
Read about return values of wctomb function .

1st Parameter Type : char *

String pointer (array of characters)

1st Parameter

Pointer to the buffer where the multibyte character will be stored. If `s` is `NULL`, the function resets the conversion state.

2nd Parameter Type : wchar_t

A data type used to represent wide characters, typically supporting larger character sets such as Unicode. Its size is platform-dependent but is often 2 or 4 bytes.

2nd Parameter

The wide character to be converted to a multibyte character.

Read more about parameters of wctomb in parameters section
The wctombfunction in C language Converts a wide character to its multibyte representation.
wctomb converts a wide character to its multibyte character representation. It stores the multibyte character representation of wchar in the array pointed to by s (if s is not NULL). The function affects the mbstate_t object maintained internally by the function.
The wctombfunction takes 2 parameters:
  • char * `s`: Pointer to the buffer where the multibyte character will be stored. If `s` is `NULL`, the function resets the conversion state.
  • wchar_t `wc`: The wide character to be converted to a multibyte character.
Converts the wide character `wc` to its multibyte representation and stores it in the buffer pointed to by `s`. Returns the number of bytes written to `s`, or `-1` if the wide character cannot be converted. If `s` is `NULL`, the function resets its internal state and returns a non-negative value if the encoding is state-dependent.
The wctomb function return value :
  • Returns the number of bytes that constitute the multibyte character corresponding to wchar
  • If s is NULL, the function returns a nonzero value if multibyte character encodings are state-dependent, and zero otherwise
  • If wchar is an invalid wide character, -1 is returned

Output

This example demonstrates the basic usage of wctomb to convert a wide character to its multibyte representation.