Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : vfprintf

intvfprintf(FILE * stream,const char * format,va_list args) ;

Return Type : int

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

1st Parameter Type : FILE *

Pointer to FILE structure for file operations

1st Parameter

Pointer to the output stream where the formatted output will be written.

2nd Parameter Type : const char *

Pointer to read-only string

2nd Parameter

Pointer to a null-terminated string specifying the format of the output. It may include format specifiers such as `%d`, `%s`, etc.

3rd Parameter Type : va_list

A data type used to hold information about variable arguments passed to a variadic function. It is initialized with `va_start`, used with `va_arg`, and cleaned up with `va_end`.

3rd Parameter

The variable argument list containing the values to be formatted and written, initialized with `va_start`.

Read more about parameters of vfprintf in parameters section
The vfprintffunction in C language Prints formatted output to the specified stream using a va_list.
vfprintf is similar to fprintf, but instead of taking a variable number of arguments, it takes a va_list that has been initialized by va_start. This function is useful for implementing custom variadic functions that need to forward their arguments to fprintf.
The vfprintffunction takes 3 parameters:
  • FILE * `stream`: Pointer to the output stream where the formatted output will be written.
  • const char * `format`: Pointer to a null-terminated string specifying the format of the output. It may include format specifiers such as `%d`, `%s`, etc.
  • va_list `args`: The variable argument list containing the values to be formatted and written, initialized with `va_start`.
Writes the formatted output to the specified `stream` based on the format string `format` and the values in the `va_list` object `args`. Returns the number of characters written, or a negative value if an error occurs.
The vfprintf function return value :
  • Returns the number of characters written, or a negative value if an error occurred

Output

This example demonstrates using vfprintf in a custom logging function that can write to different streams.