Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : putc

intputc(int character,FILE * stream) ;

Return Type : int

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

1st Parameter Type : int

Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)

1st Parameter

The character to be written, represented as an `int`. The value is internally converted to `unsigned char`.

2nd Parameter Type : FILE *

Pointer to FILE structure for file operations

2nd Parameter

Pointer to the `FILE` stream where the character is to be written.

Read more about parameters of putc in parameters section
The putcfunction in C language Writes a character to the specified stream.
The putc function writes a single character to the specified output stream at the current position. It is equivalent to fputc() but may be implemented as a macro, which means it may evaluate the stream argument more than once. This function is commonly used for character-by-character output to files or other streams.
The putcfunction takes 2 parameters:
  • int `character`: The character to be written, represented as an `int`. The value is internally converted to `unsigned char`.
  • FILE * `stream`: Pointer to the `FILE` stream where the character is to be written.
Writes the character specified by `character` to the output stream pointed to by `stream`. Returns the character written as an `unsigned char` cast to `int`, or `EOF` if an error occurs. Typically used for character-by-character output.
The putc function return value :
  • Returns the character written as an unsigned char cast to an int if successful, or EOF if an error occurred

Output

This example demonstrates how to use putc to write a string character by character to a file. It also shows proper error checking.