C++程序出现一堆屯字,程序如下,是将一个文本链接到另一个后面。
#include"iostream.h"#include"stdio.h"#include"stdlib.h"voidmain(){FILE*t,*s;charch;if...
#include "iostream.h"
#include "stdio.h"
#include "stdlib.h"
void main()
{
FILE *t,*s;
char ch;
if((s=fopen("t1.txt","a+"))==NULL)
{
cout<<"can't open file\n";
exit(1);
}
fputs("abcd",s);
if((t=fopen("t2.txt","a+"))==NULL)
{
cout<<"can't open file\n";
exit(1);
}
fputs("cdef",t);
while((ch=fgetc(s))!=EOF)
{
fputc(ch,t);
}
fclose(t),fclose(s);
} 展开
#include "stdio.h"
#include "stdlib.h"
void main()
{
FILE *t,*s;
char ch;
if((s=fopen("t1.txt","a+"))==NULL)
{
cout<<"can't open file\n";
exit(1);
}
fputs("abcd",s);
if((t=fopen("t2.txt","a+"))==NULL)
{
cout<<"can't open file\n";
exit(1);
}
fputs("cdef",t);
while((ch=fgetc(s))!=EOF)
{
fputc(ch,t);
}
fclose(t),fclose(s);
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询