I am trying to compare letter by letter a text in a file with other text in another file. If there is a similarity, it prints a bit in a different file which is the "output" file.
In fact it only works for the first letter of the text.
Can someone explain to me?
Here's my program :
void write_from_file(){
FILE*f1 = fopen("Test.txt","r");
FILE*f2 = fopen("dictionnaire.txt","r");
FILE*f3 = fopen("output.txt","a+");
int c=0;
do{
c = fgetc(f1);
do {
char c2;
int bi;
fscanf(f2,"%c %d",&c2, &bi);
printf("c = %c\n",c);
printf("c2 = %c\n",c2);
if(c==c2){
printf("%d",bi);
}
}while(!feof(f2));
}while(c != EOF);
}
here's the dictionary :
a 500000001 b 500000010 c 500100001 d 500000011 e 500000100 f 500000101 g 500000110 h 500000111 i 500001000 j 500001001 k 500001010 l 500001011 m 500001100 n 500001101 o 500001110 p 500001111 q 500010000 r 500010001 s 500010010 t 500010011 u 500010100 v 500010101 w 500010111 x 500011000 y 500011001 z 500011010 A 510000001 B 510000010 C 510000001 D 510000011 E 510000100 F 510000101 G 510000110 K 510000111 I 510001000 J 510001001 K 510001010 L 510001011 M 510001100 N 510001101 O 510001110 P 510001111