Scroll Down to See All▾
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1ynFunction Details : setvbuf
intsetvbuf(FILE * stream,char * buffer,int mode,size_t size) ;
Return Type : int
Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
Read about return values of setvbuf function .
1st Parameter Type : FILE *
Pointer to FILE structure for file operations
1st Parameter
Pointer to the `FILE` stream whose buffering mode is to be set.
2nd Parameter Type : char *
String pointer (array of characters)
2nd Parameter
Pointer to a user-provided buffer to be used for stream I/O. If `buffer` is `NULL`, the function allocates an internal buffer if necessary.
3rd Parameter Type : int
Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
3rd Parameter
The buffering mode to set for the stream: `_IOFBF` (full buffering), `_IOLBF` (line buffering), or `_IONBF` (no buffering).
4th Parameter Type : size_t
Platform-specific unsigned type for array indices and memory sizes.
4th Parameter
The size of the buffer in bytes, if `buffer` is not `NULL`.
Read more about parameters of setvbuf in parameters section
The setvbuffunction in C language Sets a specific buffer and buffering mode for the given stream.
The setvbuf function allows you to specify the buffering mode and buffer size for a stream. It can be used to optimize I/O operations by controlling how data is buffered before being read from or written to a device.
The setvbuffunction takes 4
parameters:Sets the buffering mode and buffer size for the specified `FILE` stream. The mode can be full buffering (`_IOFBF`), line buffering (`_IOLBF`), or no buffering (`_IONBF`). If `buffer` is `NULL`, an internal buffer is used. Returns `0` on success or a nonzero value on failure.
- •FILE * `stream`: Pointer to the `FILE` stream whose buffering mode is to be set.
- •char * `buffer`: Pointer to a user-provided buffer to be used for stream I/O. If `buffer` is `NULL`, the function allocates an internal buffer if necessary.
- •int `mode`: The buffering mode to set for the stream: `_IOFBF` (full buffering), `_IOLBF` (line buffering), or `_IONBF` (no buffering).
- •size_t `size`: The size of the buffer in bytes, if `buffer` is not `NULL`.
The setvbuf function return value :
- Returns 0 on success, or a non-zero value if an invalid value is given for mode or if the request cannot be honored
Output
This example sets a custom fully buffered buffer for a file stream using setvbuf.