File system

File system rename

rename

// PROTOTYPE
int rename(const char* oldpath, const char* newpath)

Renames a file from the file system. Can also move a file to a different directory.

  • oldpath: The pathname to the file (Unix-style, with forward slash as the directory separator).
  • newpath: The to rename to (Unix-style, with forward slash as the directory separator).

Returns 0 on success. On error, returns -1 and sets errno.