#include<head.h>
int main(int argc, const char *argv[])
{
if(argc!=3)
{
printf("外部传参错误\n");
return -1;
}
FILE *fp1=fopen("./1.txt","r");
if(fp1==NULL)
{
perror("fp1");
return -1;
}
FILE *fp2=fopen("./2.txt","w");
if(NULL==fp2)
{
perror("fp2");
return -1;
}
char buff[100];
while(fgets(buff,sizeof(buff),fp1)!=NULL)
{
fputs(buff,fp2);
}
fclose(fp1);
fclose(fp2);
printf("拷贝成功\n");
fp2=fopen("./2.txt","r");
if(NULL==fp2)
{
perror("fp2");
return -1;
}
while(fgets(buff,sizeof(buff),fp2)!=NULL)
{
fputs(buff,stdout);
}
fclose(fp2);
return 0;
}