#include<iostream.h>
#include<stdio.h>
#include<string.h>
void remplir(FILE *f)
{
char c;
char fichier[20];
printf("entrer les nom du fichier:");
scanf("%s",fichier);
f=fopen(fichier,"w");
if(f==NULL)
printf("erreur");
else
while((c=getchar())!='.')
{
//putc(c,f);
fprintf(f,"%c",c);
}
}
int comparer(FILE *f,FILE *fp)
{
char l1[10],l2[10];
printf("OOO");
while((!feof(f)) && (!feof(fp)))
{
fgets(l1,2,f);
fgets(l2,2,fp);
printf("OOO");
if(strcmp(l1,l2))
{
printf("%s",l1);
printf("%s",l2);
return 0;
}
}
if(!feof(f))
{fgets(l1,10,f);
printf("%s",l1);
return 0;
}
if(!feof(fp))
{fgets(l2,10,fp);
printf("%s",l2);
return 0;
}
return 1;
}
void main()
{int i;
FILE *f1,*fp1;
remplir(f1);
remplir(fp1);
i=comparer(f1,fp1);
if(i==0)printf("!=");
else printf("==");
}
fpm777 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.