#include <iostream> #include <cstdio> int main() { const char* currentPath = "currentPath/oldname.txt"; const char* newPath = "newPath/newname.txt"; if (rename(currentPath, newPath) == 0) { std::cout << "File moved successfully." << std::endl; } else { std::cerr << "Error moving file." << std::endl; } return 0; }