#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<head.h>
int main(int argc, const char *argv[])
{
FILE *fp = fopen("./1.txt","r");
if(NULL==fp){
ERR_MSG("fopen");
return -1;
}
FILE *fp1 = fopen("./2.txt","w");
if(NULL==fp){
ERR_MSG("fopen");
return -1;
}
int count = 0;
char str[120] = "";
while(1){
if(fgets(str,sizeof(str),fp) == NULL)
break;
count++;
}
printf("count = %d\n",count);
long size = ftell(fp);
printf("size=%ld\n",size);
fseek(fp,0,SEEK_SET);
size_t rsg=fread(str,size,1,fp);
printf("rsg=%ld\n",rsg);
fwrite(str,size,1,fp1);
return 0;
}