Code:
#include <iostream.h>
int main()
{
char file[MAX_PATH];
char newfilename[MAX_PATH];
char scanf_s[5];
sprintf(scanf_s, "%%%is", MAX_PATH - 1);
char quit = 'N';
while (quit == 'N')
{
printf("Enter filename to rename:\n");
scanf(scanf_s, file);
printf("Enter new filename:\n");
scanf(scanf_s, newfilename);
if ( rename(file, newfilename) )
printf("Successfully renamed file!\n");
else
printf("Oops! Unable to rename file!\n");
printf("Rename another file (Y/N)?\n");
scanf("%c", &quit);
quit = toupper(quit);
}
return 0;
}
Something like that? Not tested and appropriate headers needs to be included, so consider it pseudo.