C/File/File Rename
Версия от 14:20, 25 мая 2010; (обсуждение)
Rename a file
#include <stdio.h>
int main(void)
{
if(rename("my.txt", "your.txt"))
printf("Rename failed.\n");
else
printf("Rename successful.\n");
return 0;
}
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;
}