Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : fdopen

FILE *fdopen(int fd,const char * mode) ;

Return Type : FILE *

Pointer to FILE structure for file operations
Read about return values of fdopen function .

1st Parameter Type : int

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

1st Parameter

File descriptor representing an open file

2nd Parameter Type : const char *

Pointer to read-only string

2nd Parameter

String specifying the file access mode (e.g., 'r', 'w', 'a')

Read more about parameters of fdopen in parameters section
The fdopenfunction in C language Associates a file descriptor with an input/output stream.
The fdopen function associates a stream with the existing file descriptor, fd. This is useful for creating a standard I/O stream from a file descriptor obtained from other system calls like open, pipe, or socket. The mode argument is used just as in fopen. The file position indicator of the new stream is set to the position indicated by the file offset associated with the file descriptor.
The fdopenfunction takes 2 parameters:
  • int `fd`: File descriptor representing an open file
  • const char * `mode`: String specifying the file access mode (e.g., 'r', 'w', 'a')
Associates a file stream with an existing file descriptor `fd`. The file access mode specified in `mode` must be compatible with the file descriptor. Returns a `FILE *` on success or `NULL` on error.
The fdopen function return value :
  • Returns a pointer to the object controlling the stream
  • If the open operation fails, it returns a null pointer

Output

This example demonstrates the basic usage of `fdopen`. It opens a file using the low-level open function, then associates it with a stream using fdopen.