#includeint main() { FILE *fp; FILE *from; char ch; char p[20]="hello"; fp = fopen("test.c","r+"); from =fopen("copy2.c","w+"); if((fp=fopen("test.c","r"))==NULL) { printf("Cannot open test.c strike any key exit!n"); exit(1); } else { fwrite(p,1,5,fp); } if((from=fopen("copy2.c","w+"))==NULL) { printf("Cannot open copy2.c strike any key exit!n"); exit(1); } else { fseek(fp,0,SEEK_SET); ch=fgetc(fp); while(ch!=EOF) { fputc(ch,from); ch=fgetc(fp); } } printf("n"); fclose(from); fclose(fp); return 0; }



