Hi,
I need to copy a file from one location say c:\a\abc.txt to c:\b\abc.txt. I used the following below code
#include <stdio.h>
#include<fstream>
int main()
{
if ( rename("c:\a\abc.txt","c:\b\abc.txt")
perror( NULL );
system("pause");
return 0;
}
when i ran this code, the original file in the folder "a" gets deleted. I do not want the original file to be deleted. what should i modify in this code so the original file remains undeleted.
and my next question is, i want to copy the original file 3 times and paste it in the new location 3 times, and each time while pasting i want the file name like this "abc1.txt", "abc2.txt", "abc3.txt"...and so on till i give a condition, so how to implement this?
Thanks
Priya