名稱
函式名: rename
功能: 重命名檔案
用法: int rename(char *oldname, char *newname);
程式例
#include <stdio.h>
int main(void)
{
char oldname【80】, newname【80】;
/* prompt for file to rename and new name */
printf("File to rename: ");
gets(oldname);
printf("New name: ");
gets(newname);
/* Rename the file */
if (rename(oldname, newname) == 0)
printf("Renamed %s to %s.\n", oldname, newname);
else
perror("rename");
return 0;
}