#include "stdio.h"
#include "stdlib.h"
char buff[32768];
main(int argc,char *argv[])
{
FILE *fp1,*fp2; //定义两个文件
unsigned int bytes,Bsize=32768;
unsigned long i=0;
if((fp1=fopen(argv[1],"rb"))==0) //读文件
{printf("can't open file %s.",argv[1]);exit(0);}
if((fp2=fopen(argv[2],"w"))==0) //写文件
{printf("can't open file %s.",argv[2]);exit(0);}
while(Bsize) //下面拷贝文件
{
if(fread(buff,Bsize,1,fp1))
{
fwrite(buff,Bsize,1,fp2);
i=i+Bsize;
}
else
{
fseek(fp1,i,0);
Bsize=Bsize/2;
}
}
fclose(fp1);
fclose(fp2); //关闭文件
}
或者system("[command]");
如果操作系统一定的话也可以用这个。command就是控制台命令
API CopyFile...