#include <stdio.h>
#include <stdlib.h>
void main(void)
{
FILE *in,*out;
char ch;
if((in=fopen("d:\\txt\\ch1.txt","r"))==NULL)
{
printf("Can't open ch1file!\n");
exit(1);
}
if((out=fopen("d:\\txt\\ch2.txt","w"))==NULL)
{
printf("Can't open ch2file!\n");
exit(1);
}
//判斷文件是否處於文件結束位置,結束返回1,未結束返回0
while(!feof(in))
{
ch=fgetc(in);
fputc(ch,out);
}
fclose(in);
fclose(out);
}