橘子味的心
标题:C库函数 rename()

C库函数 rename()

#include <stdio.h>



int main () {

   int ret;

   char oldname[] = "file.txt";

   char newname[] = "newfile.txt";



   ret = rename(oldname, newname);



   if(ret == 0) {

      printf("File renamed successfully");

   } else {

      printf("Error: unable to rename the file");

   }



   return(0);

}

目录

分类