libwchar2 0.0.10
wrename manual

wrename - change the name or location of a file

wrename() renames a file, moving it between directories if required. Any other hard links to the file (as created using link(2)) are unaf- fected. Open file descriptors for oldpath are also unaffected.

Various restrictions determine whether or not the rename operation suc- ceeds: see ERRORS below.

If newpath already exists, it will be atomically replaced, so that there is no point at which another process attempting to access newpath will find it missing. However, there will probably be a window in which both oldpath and newpath refer to the file being renamed.

If oldpath and newpath are existing hard links referring to the same file, then wrename() does nothing, and returns a success status.

If newpath exists but the operation fails for some reason, wrename() guarantees to leave an instance of newpath in place.

oldpath can specify a directory. In this case, newpath must either not exist, or it must specify an empty directory.

If oldpath refers to a symbolic link, the link is renamed; if newpath refers to a symbolic link, the link will be overwritten.

Return Value

On success, zero is returned.
On error, -1 is returned, and errno is set appropriately.

See example

See also
https://github.com/ClnViewer/LibWchar2/blob/master/test/test_wrename.c

LibWchar2 information
Version
libwchar2 0.0.10
Date
Wed Aug 22 2018
Author
(c) PS 2018-2018
Manual author and license