#include #include copy(FILE * fin,FILE * fout) { int ch; ch = getc(fin); while(ch!=EOF) { putc(ch,fout); ch = getc(fin); } } main(int argc,char ** argv) { FILE * fin, * fout; if(argc!=3) { printf("copy: wrong number of arguments\n"); exit(0); } fin = fopen(argv[1],"r"); if(fin==NULL) { printf("copy: can't open %s\n",argv[1]); exit(0); } fout = fopen(argv[2],"w"); if(fout==NULL) { printf("copy: can't open %s\n",argv[2]); exit(0); } copy(fin,fout); fclose(fin); fclose(fout); }