70,037
社区成员
发帖
与我相关
我的任务
分享
#include <cstdio>
#include <cstdlib>
int main(int argc, char *argv[])
{
FILE *in,*out;
char ch;
if ((in=fopen("test1.txt","rb"))==NULL)
{
printf("\n打开文件test1.txt出错!\n");
exit (0);
}
if ((out=fopen("test2.txt","wb"))==NULL)
{
printf("\n打开文件出错!\n");
exit (0);
}
while (!feof(in))
{
ch=fgetc(in);
if (feof(in)) break;
fputc(ch,out);
}
fclose(in);
fclose(out);
return 0;
}