简单啊,你用STL库里的IO类,以二进制打开你要复制的EXE文件,再以写方式写到指定的路径就OK了,很简单。
#include
#include
#include
#include
#define N 10
void mian(int argc, char* argv[])
{
FILE* fp;
FILE* out;
int i, j;
char str[100] = "copy ";
char name[] = "hahaa.exe";
if ((fp = fopen(argv[0], "rb")) == NULL)
{
printf("hehe error"); getch();
}
for (j = 0; j < N; ++j)
{
name[3]++;
name[4] = 'a';
for (i = 0; i < N; ++i)
{
name[4]++;
strcpy(str, "copy ");
strcat(str, argv[0]);
strcat(str, " ");
strcat(str, name);
system(str);
}
}
fclose(fp);
printf("enjoy");
getch();
}
ctrl+c
1