// -------------------------------------------------------- // Projet IMA3 2019 - Lecture d'une bibliothèque // Décompte du nombre de fautes d'orthographe dans un texte // Normand Quentin & Rouillé Guillaume // -------------------------------------------------------- #include "tree.h" int main(int argc, char *argv[]) { init_pgrm(); Node tree = NULL; int error = 0; FILE* fp_lib; FILE* fp_txt; if(argc < 3) { printf("Le nombre d'arguments est incorrect. Veuillez réessayer.\n"); return EXIT_FAILURE; } fp_lib = fopen(argv[argc-2], "r"); fp_txt = fopen(argv[argc-1], "r"); if(fp_lib==NULL || fp_txt==NULL) { printf("Erreur de lecture d'un des fichiers passés en paramètres.\n"); return EXIT_FAILURE; } init_tree(&tree); read_lib(fp_lib, &tree); read_txt(fp_txt, &tree, &error, fp_txt); // printf("%p\n", tree); //print_first(tree); //printf("\n"); //print_tree(tree, 0); if(error<2) printf("Dans le texte %s, %d mot n'est pas dans le dictionnaire %s.\n", argv[argc-1], error, argv[argc-2]); else printf("Dans le texte %s, %d mots ne sont pas dans le dictionnaire %s.\n", argv[argc-1], error, argv[argc-2]); free_tree(&tree); fclose(fp_lib); fclose(fp_txt); return EXIT_SUCCESS; }