Scroll Down to See All▾
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1ynFunction Details : fgetpos
intfgetpos(FILE * stream,fpos_t * pos) ;
Return Type : int
Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
Read about return values of fgetpos function .
1st Parameter Type : FILE *
Pointer to FILE structure for file operations
1st Parameter
Pointer to the file stream whose current position is to be retrieved
2nd Parameter Type : fpos_t *
A pointer to an `fpos_t` object, used to store or set a file position in functions like `fgetpos` and `fsetpos`. It allows the file position to be manipulated and reused.
2nd Parameter
Pointer to an `fpos_t` object where the current file position will be stored
Read more about parameters of fgetpos in parameters section
The fgetposfunction in C language Gets the current file position of the stream and stores it in a position indicator.
The fgetpos function obtains the current value of the file position indicator for the stream pointed to by stream. The position is stored in the object pointed to by pos. This function is useful for saving the current position in a file, which can later be restored using fsetpos. It's particularly helpful when working with large files or when precise positioning is required.
The fgetposfunction takes 2
parameters:Retrieves the current position of the file stream and stores it in the `fpos_t` object pointed to by `pos`. The stored position can later be used with `fsetpos` to return to this point in the stream. Returns 0 on success or a nonzero value on error.
- •FILE * `stream`: Pointer to the file stream whose current position is to be retrieved
- •fpos_t * `pos`: Pointer to an `fpos_t` object where the current file position will be stored
The fgetpos function return value :
- Returns zero on success, or a non-zero value if an error occurred
- In case of an error, errno is set to indicate the specific error
Output
This example demonstrates the basic usage of `fgetpos`. It opens a file, gets its current position (which is the beginning of the file), and checks for any errors.