int fileCopy()
{
char ch;
FILE *fin;
FILE *fout;
if((fin = fopen("in.xx", "rb")) == NULL) //也可以以"rt"文本方式打开
{
printf("can't open the file/n");
return (-1);
}
if((fout = fopen("out.xx", "wb")) == NULL) //也可以以"rt"文本方式打开
{
printf("can't open the file/n");
return (-1);
}
while(!feof(fin))
{
ch = fgetc(fin);
if(ch != EOF) //在这里加一个条件判断便可
fputc(ch, fout);
}
fclose(fin);
fclose(fout);
system("PAUSE");
return 0;
}
阅读(1792) | 评论(0) | 转发(0) |