Scroll Down to See All▾
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1ynFunction Details : rename
intrename(const char * oldname,const char * newname) ;
Return Type : int
Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
Read about return values of rename function .
1st Parameter Type : const char *
Pointer to read-only string
1st Parameter
Pointer to a null-terminated string containing the name of the file or directory to be renamed.
2nd Parameter Type : const char *
Pointer to read-only string
2nd Parameter
Pointer to a null-terminated string containing the new name for the file or directory.
Read more about parameters of rename in parameters section
The renamefunction in C language Renames a file or directory.
The rename function changes the name of a file or directory. It can also be used to move a file between directories on the same file system. If a file with the new name already exists, it may be overwritten depending on the system and implementation.
The renamefunction takes 2
parameters:Renames the file or directory specified by `oldname` to `newname`. If `newname` already exists, its behavior is implementation-defined, but it may overwrite the existing file or directory. Returns `0` on success or a nonzero value on failure, with `errno` set to indicate the error.
- •const char * `oldname`: Pointer to a null-terminated string containing the name of the file or directory to be renamed.
- •const char * `newname`: Pointer to a null-terminated string containing the new name for the file or directory.
The rename function return value :
- Returns 0 if the file was successfully renamed, non-zero if an error occurred
Output
This example creates a file, closes it, and then renames it using the rename function.