源程序:
#include <stdio.h>
#include <stdlib.h>
void filecopy(FILE *,FILE *);
int main()
{
FILE *fpin,*fpout;
fpin=fopen("e:\file_a.txt","r");
fpout=fopen("e:\file_b.txt","w");
filecopy(fpin,fpout);
fclose(fpin);
fclose(fpout);
return 1;
}
void filecopy(FILE *fpin,FILE *fpout)
{
char ch;
ch=getc(fpin);
while(!feof(fpin))
{
putc(ch,fpout);
ch=getc(fpin);
}
}
运行结果: