diff --git a/dico_test b/dico_test index a25ef39..ca291e3 100644 --- a/dico_test +++ b/dico_test @@ -3,4 +3,5 @@ ba aa' abc c -d' \ No newline at end of file +d' +aƩ \ No newline at end of file diff --git a/find.c b/find.c index 6b60c93..9e4bc3c 100644 --- a/find.c +++ b/find.c @@ -1,7 +1,7 @@ #include "find.h" -int find_mot(struct node **tab_ptr_tree,char mot[],int size,int fl) +int find_mot(struct node **tab_ptr_tree,wchar_t mot[],int size,int fl) { if(size==1 && tab_ptr_tree[fl]!=NULL) { diff --git a/find.h b/find.h index 5bb41e5..acb21c1 100644 --- a/find.h +++ b/find.h @@ -2,4 +2,4 @@ int find(); -int find_mot(struct node **,char*,int,int); \ No newline at end of file +int find_mot(struct node **,wchar_t*,int,int); \ No newline at end of file diff --git a/main.c b/main.c index 34b5194..8624150 100644 --- a/main.c +++ b/main.c @@ -2,8 +2,9 @@ int main() { - FILE* fp = fopen("american-english","r"); - //FILE* fp = fopen("dico_test","r"); + setlocale(LC_ALL, ""); + //FILE* fp = fopen("american-english","r"); + FILE* fp = fopen("dico_test","r"); if(fp == NULL) return 1 ; //File is not readable @@ -18,11 +19,11 @@ int main() printf("Loading done!\n"); - char mot[50]; + wchar_t mot[50]; int taille; taille = 8; - scanf("%s",mot); - scanf("%d",&taille); + wscanf(L"%ls",mot); + wscanf(L"%d",&taille); int result; result = find_mot(tab,mot,taille,0); printf("%d\n",result); diff --git a/tree.c b/tree.c index 058934c..c902308 100644 --- a/tree.c +++ b/tree.c @@ -1,6 +1,6 @@ #include "tree.h" -void cons_tree(struct node ** ptr_tree, int val) +void cons_tree(struct node ** ptr_tree, wchar_t val) { *ptr_tree = malloc(sizeof(struct node)); (*ptr_tree)->val = val; @@ -20,7 +20,7 @@ int is_leaf(struct node *tree) return tree->fin||tree->fils[0]==NULL; } -void add(struct node **tab_ptr_tree, char val[],int taille, int fl) +void add(struct node **tab_ptr_tree, wchar_t val[],int taille, int fl) { if(tab_ptr_tree[fl]==NULL)cons_tree(&(tab_ptr_tree[fl]),val[0]+97); Node* noeudtest = tab_ptr_tree[fl]; @@ -46,7 +46,7 @@ void add(struct node **tab_ptr_tree, char val[],int taille, int fl) } -int size(char val[]) +int size(wchar_t val[]) { int cpt = 0; while(val[cpt]!='\0') @@ -56,7 +56,7 @@ int size(char val[]) return cpt; } -void toLowerCase(char mot[],int size) +void toLowerCase(wchar_t mot[],int size) { for(int i=0;i'z')continue; //if(val[0]<97)val[0]+=32; //val[0]-=97; add(tab_ptr_tree,val,taille,(int)val[0]-97); diff --git a/tree.h b/tree.h index 6038322..b913107 100644 --- a/tree.h +++ b/tree.h @@ -1,20 +1,22 @@ #include #include +#include +#include typedef struct node { - int val; + wchar_t val; int fin; int nbr_fils; struct node** fils; }Node, *PtNode, *Tree; -void cons_tree(struct node **, int); +void cons_tree(struct node **, wchar_t); void mk_empty_tree(struct node **); int is_leaf(struct node *); -void add(struct node **, char* ,int ,int); +void add(struct node **, wchar_t* ,int ,int); void load_tree(FILE *, struct node **); -- libgit2 0.21.2