Scroll Down to See All▾
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1ynFunction Details : setbuf
voidsetbuf(FILE * stream,char * buffer) ;
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 for the stream. If `buffer` is `NULL`, the stream will be set to unbuffered mode.
Read more about parameters of setbuf in parameters section
The setbuffunction in C language Sets the buffer to be used by the stream for I/O operations.
The setbuf function is used to associate a buffer with a stream or to disable buffering. If the buffer is NULL, buffering is disabled. Otherwise, the buffer must have a size of at least BUFSIZ bytes, where BUFSIZ is a macro constant defined in <stdio.h>.
The setbuffunction takes 2
parameters:Sets the buffering mode for the specified `FILE` stream. If `buffer` is `NULL`, the stream is unbuffered. Otherwise, the stream will use the provided buffer for I/O. The size of the buffer must be at least `BUFSIZ` bytes. This function should be called before any other operations on the stream.
- •FILE * `stream`: Pointer to the `FILE` stream whose buffering mode is to be set.
- •char * `buffer`: Pointer to a user-provided buffer for the stream. If `buffer` is `NULL`, the stream will be set to unbuffered mode.
The setbuf function return value :
- This function does not return a value
Output
This example demonstrates how to set a custom buffer for a file stream using setbuf.