你会用fopen么?
char c1,c2;
FILE *fp1,*fp2,*out;三个这项文件的指针
fp1=fopen("aaa.txt","r");
fp2=fopen("bbb.txt","r");
out=fopen("ccc.txt","w+");
c1 = getc(fp1);从文件中取一个字符,取完以后指针(fp1)指向第二个字符知道\0结束
c2 = getc(fp2);
while(c1!='\0')
{
while(c2!='\0')
{
if(c1==c2)
putc(c1,out);
c2 = getc(fp2);
}
fclose(fp2);
c1 = getc(fp1);
fp2=fopen("bbb.txt","r");
}
fclose(fp2);
fclose(fp1);
fclose(out);
我只是给你个思想,自己再改改吧,我也好久不用文件了
找点这方面的书学习一下,可以看看C函数库,里面介绍了你听说过,没听说过的全部函数