Commit 35bdc27170459aabd5d74607dafbe9de446b9469
1 parent
0164603a
affichage
Showing
1 changed file
with
53 additions
and
8 deletions
Show diff stats
@@ -4,17 +4,62 @@ | @@ -4,17 +4,62 @@ | ||
4 | #include <string.h> | 4 | #include <string.h> |
5 | #include "arbre.h" | 5 | #include "arbre.h" |
6 | 6 | ||
7 | -int main () { | ||
8 | - FILE* fp = fopen("words-no-accents","r"); //amelioration entrée | ||
9 | - if(fp == NULL){ return EXIT_FAILURE;} //File is not readable | ||
10 | - | 7 | +int main (int argc,char *argv[]){ |
8 | + system("clear"); | ||
9 | + FILE* dico = NULL; | ||
10 | + printf("==============================================\n"); | ||
11 | + if(argc >1){ | ||
12 | + printf("chargement de votre dictionnaire \n"); | ||
13 | + printf("nom: %s\n",argv[1]); | ||
14 | + dico=fopen(argv[1],"r"); | ||
15 | + } | ||
16 | +// else dico=fopen("words-no-accents","r"); | ||
17 | + | ||
18 | + if(dico == NULL){ | ||
19 | +// return EXIT_FAILURE; | ||
20 | + printf("chargement du dictionnaire par default\n"); | ||
21 | + printf("nom du dico: words-no-accents\n"); | ||
22 | + dico=fopen("words-no-accents","r"); | ||
23 | + } //File is not readable | ||
24 | + | ||
11 | struct dico *mondico=malloc(sizeof(struct dico)); | 25 | struct dico *mondico=malloc(sizeof(struct dico)); |
12 | - charger_arbre(fp,&mondico); | ||
13 | - affiche_dico(mondico); | 26 | + charger_dico(dico,&mondico); |
27 | +// affiche_dico(mondico); | ||
28 | + fclose(dico); | ||
29 | + printf("==============================================\n\n\n"); | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + char mot[]="zombie"; | ||
34 | + char mot2[]="chaine"; | ||
35 | + mot_existe(mondico->alpha[calculcase('r')],"rerere",0); | ||
36 | + mot_existe(mondico->alpha[calculcase(mot[0])],mot,0); | ||
37 | + mot_existe(mondico->alpha[calculcase(mot2[0])],mot2,0); | ||
14 | 38 | ||
39 | +// printf("1: %s:%d \n",mot,mot_existe(mondico->alpha[calculcase(mot[0])],mot,0)); | ||
40 | +// printf("2: %s:%d \n",mot2,mot_existe(mondico->alpha[calculcase(mot2[0])],mot2,0)); | ||
15 | 41 | ||
42 | + FILE* fichier_utilisateur = NULL; | ||
43 | + if(argc >2){ | ||
44 | + printf("Analyse de votre fichier \n"); | ||
45 | + fichier_utilisateur=fopen(argv[2],"r"); | ||
46 | + printf("Fin Analyse de votre fichier \n"); | ||
47 | + } | ||
48 | + | ||
49 | + if (fichier_utilisateur!=NULL){ | ||
50 | + printf("analyse en cours\n"); | ||
51 | + int juste=0; | ||
52 | + int faux=0; | ||
53 | + analyse_fichier(fichier_utilisateur,mondico,&juste,&faux); | ||
54 | + printf("juste:%d \n",juste); | ||
55 | + printf("faux:%d \n",faux); | ||
56 | + } | ||
57 | + | ||
58 | + printf("fin programme \n"); | ||
16 | free_dico(mondico); | 59 | free_dico(mondico); |
17 | - fclose(fp); | 60 | + if (fichier_utilisateur!=NULL){ |
61 | + fclose(fichier_utilisateur); | ||
62 | + } | ||
63 | + | ||
18 | return 0; | 64 | return 0; |
19 | } | 65 | } |
20 | - |