devxlogo

Renaming a File

To rename a file, use the standard function rename() (declared in ). This function takes two arguments of type const char *, the first of which is the old name and the second one is the new name of the file:

 include int main(){ int stat=rename("backup.dat", "backup.old"); if (stat)  printf("rename failed");}

On success, rename() returns zero; otherwise, it returns an error code indicating various types of errors.

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  How Seasoned Architects Evaluate New Tech

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.