diff --git a/main.c b/main.c
index 39a4d1175e5171544fbc5680b4139b1f333fd9cb..17cac03ac6b6465000840605ec66431d9227fb5f 100644
--- a/main.c
+++ b/main.c
@@ -5,6 +5,8 @@
 
 int main(int argc, char** argv) {
    arbre tree = arbre_build("code-morse.txt");
+   // printf("%c\n",decoder("--..",tree));
+   decoder_fichier("text.morse",tree);
    exit(0);
    // print(tree,1);   // impression de l'arbre
    // if (2 == argc) {
diff --git a/morse.c b/morse.c
index 783a1b67c0ddff42f7887566fd7599a48f6f3c37..6df77e8871b313aaf4d8a256ccb15d4074c7e1df 100644
--- a/morse.c
+++ b/morse.c
@@ -23,7 +23,7 @@ char decoder(char *code, arbre tree)
    uint32_t len = strlen(code);
    for (uint32_t i = 0; i < len; i += 1)
    {
-      tmp = tmp->child[(code[i] == '.') ? 0 : 1];
+      tmp = tmp->child[(code[i] == '-') ? 1 : 0];
    }
    return tmp->lettre;
 }
@@ -37,17 +37,30 @@ void decoder_fichier(char *filename, arbre tree)
    // lecture d'un mot de caract�res dans 'A'..'Z'
    FILE *fp = fopen(filename, "r");
    assert(NULL != fp);
-   int lg = 0;
+   // char* res = calloc(1024, sizeof(char));
+   uint32_t index = 0;
    char code[6];
+   printf("Text : \n");
    while (!feof(fp))
    {
       char ch = (char)fgetc(fp);
-      switch (ch)
+      if(ch == ' ')
       {
-         //� compl�ter
+         printf("%c",decoder(code,tree));
+         memset(code,0,6);
+         index = 0;
+      }else if(ch == '/')
+      {
+         printf(" ");
+      }
+      else if(ch == '-' || ch == '.')
+      {
+         code[index] = ch;
+         index += 1;
       }
    }
    fclose(fp);
+   printf("\n\n");
 }
 
 //-----------------------------------------------------------
@@ -79,8 +92,23 @@ void encoder_fichier(char *filename, int n, int m, char alphabet_morse[n][m])
 void placer(char *chaine, arbre *tree)
 {
    arbre tmp = *tree;
-   int length = strlen(chaine);
-   // � compl�ter
+   uint32_t length = strlen(chaine);
+
+   for (uint32_t i = 1; i < length-1; i += 1)
+   {
+      uint8_t pos = (chaine[i] == '-') ? 1 : 0;
+      if (tmp->child[pos] == NULL)
+      {
+         tmp->child[pos] = calloc(1, sizeof(node));
+         tmp = tmp->child[pos];
+         tmp->lettre = '?';
+      }
+      else
+      {
+         tmp = tmp->child[pos];
+      }
+   }
+
    tmp->lettre = chaine[0];
 }
 
@@ -96,6 +124,7 @@ void table_build(char *filename, int n, int m, char alphabet_morse[n][m])
    fclose(fp);
 }
 
+
 //----------------------------------------------------------
 // procedure lisant le fichier code-morse.txt et cr�ant   --
 // l'arbre binaire correspondant                          --
@@ -109,18 +138,23 @@ arbre arbre_build(char *filename)
    assert(NULL != fp);
 
    char line[100];
+   uint32_t line_number = 0;
    while (!feof(fp))
    {
       arbre tmp_ptr = tree;
+      line_number += 1;
       fgets(line, 100, fp);
       char cur_char = line[0];
       char *morse = calloc(strlen(line), sizeof(char));
       sprintf(morse, "%s", line + 1);
-      printf("%c : %s : %d\n", cur_char, morse,strlen(morse));
-      for(uint32_t i=0;i<strlen(morse)-1;i+=1)
+      if (morse[strlen(morse)-1] == '\n')
+      {
+         morse[strlen(morse)-1] = '\0';
+      }
+      for (uint32_t i = 0; i < strlen(morse); i += 1) // strlen() - 1 for decrement '\n' char
       {
-         uint8_t pos = (morse[i] == '-')?1:0;
-         if(tmp_ptr->child[pos] == NULL)
+         uint8_t pos = (morse[i] == '-') ? 1 : 0;
+         if (tmp_ptr->child[pos] == NULL)
          {
             tmp_ptr->child[pos] = calloc(1, sizeof(node));
             tmp_ptr = tmp_ptr->child[pos];
@@ -131,7 +165,6 @@ arbre arbre_build(char *filename)
             tmp_ptr = tmp_ptr->child[pos];
          }
       }
-      printf("Save value : '%c' in addr : %p\n",cur_char,tmp_ptr->lettre);
       tmp_ptr->lettre = cur_char;
       free(morse);
    }