main.c
667 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "tree.h"
int main()
{
setlocale(LC_ALL, "");
//FILE* fp = fopen("american-english","r");
FILE* fp = fopen("dico_test","r");
if(fp == NULL) return 1 ; //File is not readable
struct node* tab[26];
for(int i=0;i<26;i++)
{
tab[i]=NULL;
}
//supprimer la case avant de load
load_tree(fp,tab);//chargement de l'arbre
printf("Loading done!\n");
wchar_t mot[50];
int taille;
wscanf(L"%ls",mot);
wscanf(L"%d",&taille);
int result;
result = find_mot(tab,mot,taille,(int)mot[0]-97);
printf("%d\n",result);
free_dico(tab);//libérer la mémoire
fclose(fp);
printf("Fin du programme\n");
return 0;
}