The following is a somewhat ironic solution that itself does not use a standard system call rename(2):
#include <stdlib.h>
if (system("mv file1 file2") != 0)
perror("system");
This is an indirect use rename(2), this syscall is called mv(1).
source
share