Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : strfmon

intstrfmon(char * str,size_t maxsize,const char * format,... args) ;

Return Type : int

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

1st Parameter Type : char *

String pointer (array of characters)

1st Parameter

Pointer to the buffer where the formatted output will be stored.

2nd Parameter Type : size_t

Platform-specific unsigned type for array indices and memory sizes.

2nd Parameter

The maximum number of bytes, including the null terminator, that can be written to the buffer.

3rd Parameter Type : const char *

Pointer to read-only string

3rd Parameter

A null-terminated format string specifying the monetary format and any additional options for the output.

4th Parameter Type : ...

Represents a variable number of arguments in a function. Used in functions like `printf` or `fprintf` to accept additional parameters beyond those explicitly declared.

4th Parameter

A variable number of arguments to format according to the specified format string.

Read more about parameters of strfmon in parameters section
The strfmonfunction in C language Formats monetary values according to the locale settings.
The strfmon function formats monetary values into a string according to the current locale's settings. It allows for flexible formatting of currency amounts, including currency symbols, thousands separators, and decimal points.
The strfmonfunction takes 4 parameters:
  • char * `str`: Pointer to the buffer where the formatted output will be stored.
  • size_t `maxsize`: The maximum number of bytes, including the null terminator, that can be written to the buffer.
  • const char * `format`: A null-terminated format string specifying the monetary format and any additional options for the output.
  • ... `args`: A variable number of arguments to format according to the specified format string.
Formats and writes monetary values to the buffer `str` according to the `format` string and the provided arguments. The formatting is based on the current locale's monetary settings. Writes at most `maxsize` bytes, including the null terminator. Returns the number of bytes written on success or `-1` if an error occurs.
The strfmon function return value :
  • Returns the number of characters placed in the array pointed to by s, not including the terminating null character
  • If the resulting string is too long to fit in n bytes, a negative value is returned and errno may be set to ERANGE

Output

This example demonstrates basic usage of strfmon to format a monetary value using the system's default locale.