Commit b2638a8a96e1a9614d9e0695076fd1c88bd4598e
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,7 +165,7 @@ void test_words(dico d,FILE*inStream,FILE*outStream){ | ||
165 | if(isIn<1){ | 165 | if(isIn<1){ |
166 | if(someWrong==0){ | 166 | if(someWrong==0){ |
167 | someWrong=1; | 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 | fprintf(outStream,"%s est absent dans le dictionnaire",word); | 170 | fprintf(outStream,"%s est absent dans le dictionnaire",word); |
171 | if(isIn) | 171 | if(isIn) |
@@ -42,6 +42,8 @@ void menu(dico monDico){ | @@ -42,6 +42,8 @@ void menu(dico monDico){ | ||
42 | //initialisation | 42 | //initialisation |
43 | printf("Pour commencer, veuillez charger un dictionnaire.\n"); | 43 | printf("Pour commencer, veuillez charger un dictionnaire.\n"); |
44 | FILE*fileIn=getFile("r"),*fileOut=stdout; | 44 | FILE*fileIn=getFile("r"),*fileOut=stdout; |
45 | + if(fileIn==stdin) | ||
46 | + printf("Entrez vos mots (ctrl-D pour terminer le chargement):\n"); | ||
45 | loadfrom_file(monDico,fileIn); | 47 | loadfrom_file(monDico,fileIn); |
46 | fclose(fileIn); | 48 | fclose(fileIn); |
47 | 49 | ||
@@ -63,8 +65,9 @@ void menu(dico monDico){ | @@ -63,8 +65,9 @@ void menu(dico monDico){ | ||
63 | //out stream | 65 | //out stream |
64 | printf("6) Définir un fichier de sortie.\n"); | 66 | printf("6) Définir un fichier de sortie.\n"); |
65 | printf("7) Définir la sortie sur le terminal.\n"); | 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 | choice=ctoi(*word); | 71 | choice=ctoi(*word); |
69 | 72 | ||
70 | switch(choice){ | 73 | switch(choice){ |
@@ -80,8 +83,11 @@ void menu(dico monDico){ | @@ -80,8 +83,11 @@ void menu(dico monDico){ | ||
80 | //manip sur le dictionnaire | 83 | //manip sur le dictionnaire |
81 | case 2: {//ajout | 84 | case 2: {//ajout |
82 | fileIn=getFile("r"); | 85 | fileIn=getFile("r"); |
86 | + if(fileIn==stdin) | ||
87 | + printf("Entrez vos mots (ctrl-D pour terminer le chargement):\n"); | ||
83 | loadfrom_file(monDico,fileIn); | 88 | loadfrom_file(monDico,fileIn); |
84 | - fclose(fileIn); | 89 | + if(fileIn!=stdin) |
90 | + fclose(fileIn); | ||
85 | break;} | 91 | break;} |
86 | case 3: {//effacer | 92 | case 3: {//effacer |
87 | delete_dico(monDico); | 93 | delete_dico(monDico); |
@@ -91,14 +97,18 @@ void menu(dico monDico){ | @@ -91,14 +97,18 @@ void menu(dico monDico){ | ||
91 | delete_dico(monDico); | 97 | delete_dico(monDico); |
92 | fileIn=getFile("r"); | 98 | fileIn=getFile("r"); |
93 | loadfrom_file(monDico,fileIn); | 99 | loadfrom_file(monDico,fileIn); |
94 | - fclose(fileIn); | 100 | + if(fileIn!=stdin) |
101 | + fclose(fileIn); | ||
95 | break;} | 102 | break;} |
96 | 103 | ||
97 | 104 | ||
98 | case 5: {//faire des tests | 105 | case 5: {//faire des tests |
99 | fileIn=getFile("r"); | 106 | fileIn=getFile("r"); |
107 | + if(fileIn==stdin) | ||
108 | + printf("Entrez vos mots (ctrl-D pour terminer les tests):\n"); | ||
100 | test_words(monDico,fileIn,fileOut); | 109 | test_words(monDico,fileIn,fileOut); |
101 | - fclose(fileIn); | 110 | + if(fileIn!=stdin) |
111 | + fclose(fileIn); | ||
102 | break;} | 112 | break;} |
103 | 113 | ||
104 | //définir la sortie des tests et de "Lire" le dictionnaire | 114 | //définir la sortie des tests et de "Lire" le dictionnaire |
No preview for this file type
treeh.c