Commit b2638a8a96e1a9614d9e0695076fd1c88bd4598e

Authored by bjeanlou
1 parent 2e4421a8

création rapport

Showing 4 changed files with 17 additions and 6 deletions   Show diff stats
... ... @@ -165,7 +165,7 @@ void test_words(dico d,FILE*inStream,FILE*outStream){
165 165 if(isIn<1){
166 166 if(someWrong==0){
167 167 someWrong=1;
168   - fprintf(outStream,"Voici les mots absent du dictionnaire");
  168 + fprintf(outStream,"Voici les mots absent du dictionnaire\n");
169 169 }
170 170 fprintf(outStream,"%s est absent dans le dictionnaire",word);
171 171 if(isIn)
... ...
... ... @@ -42,6 +42,8 @@ void menu(dico monDico){
42 42 //initialisation
43 43 printf("Pour commencer, veuillez charger un dictionnaire.\n");
44 44 FILE*fileIn=getFile("r"),*fileOut=stdout;
  45 + if(fileIn==stdin)
  46 + printf("Entrez vos mots (ctrl-D pour terminer le chargement):\n");
45 47 loadfrom_file(monDico,fileIn);
46 48 fclose(fileIn);
47 49  
... ... @@ -63,8 +65,9 @@ void menu(dico monDico){
63 65 //out stream
64 66 printf("6) Définir un fichier de sortie.\n");
65 67 printf("7) Définir la sortie sur le terminal.\n");
66   -
67   - scanf("%1s",word);
  68 +
  69 + //saisie du choix
  70 + scanf("%2s",word);
68 71 choice=ctoi(*word);
69 72  
70 73 switch(choice){
... ... @@ -80,8 +83,11 @@ void menu(dico monDico){
80 83 //manip sur le dictionnaire
81 84 case 2: {//ajout
82 85 fileIn=getFile("r");
  86 + if(fileIn==stdin)
  87 + printf("Entrez vos mots (ctrl-D pour terminer le chargement):\n");
83 88 loadfrom_file(monDico,fileIn);
84   - fclose(fileIn);
  89 + if(fileIn!=stdin)
  90 + fclose(fileIn);
85 91 break;}
86 92 case 3: {//effacer
87 93 delete_dico(monDico);
... ... @@ -91,14 +97,18 @@ void menu(dico monDico){
91 97 delete_dico(monDico);
92 98 fileIn=getFile("r");
93 99 loadfrom_file(monDico,fileIn);
94   - fclose(fileIn);
  100 + if(fileIn!=stdin)
  101 + fclose(fileIn);
95 102 break;}
96 103  
97 104  
98 105 case 5: {//faire des tests
99 106 fileIn=getFile("r");
  107 + if(fileIn==stdin)
  108 + printf("Entrez vos mots (ctrl-D pour terminer les tests):\n");
100 109 test_words(monDico,fileIn,fileOut);
101   - fclose(fileIn);
  110 + if(fileIn!=stdin)
  111 + fclose(fileIn);
102 112 break;}
103 113  
104 114 //définir la sortie des tests et de "Lire" le dictionnaire
... ...
rapportDico.odt 0 → 100644
No preview for this file type
... ... @@ -26,6 +26,7 @@ void delete_tree(tree *t){
26 26 for(int i=0;i<NBCHAR;i++)
27 27 delete_tree(&((*t)->next[i]));
28 28 free(*t);
  29 + *t=NULL;
29 30 }
30 31  
31 32  
... ...