Rename a file or directory: how to use rename : File Rename « File « C / ANSI-C






Rename a file or directory: how to use rename



#include <stdio.h>

int main ()
{
  int result;
  
  char oldname[] ="old.txt";
  char newname[] ="new.txt";
  
  result= rename( oldname , newname );
  
  if (result != 0 )
    perror( "Error renaming file" );
  
  return 0;
}

           
       








Related examples in the same category

1.Rename a file